0 Replies Latest reply on Jun 4, 2009 1:32 PM by Handycam

    Counting in a column?

    Handycam Level 1

      I have a series of toggle button bars, one atop another.  It looks like a grid to the user.


      The user needs to pick only one item (at a time) in each row, which is why I used toggle button bars to begin with.  So far so good.


      What I need to do is have a total of each "column" highlighted; that is, how many button #1's, how many #2's, etc.


      So I have an itemClick handler on each TBB:


      private function clickHandler(e:ItemClickEvent):void  {
          var activeColumn:uint = e.currentTarget.selectedIndex+1;


      So I know which item is "hot" for each row.  The part that's hanging me up is the best way to convert this information into a "running total" as above.


      I have variables to hold this data, such as: [Bindable] private var numberOfOnes:uint;


      I assume I will make a function to do the counting: what I see is to process each row, and then if the index is 0, increment numberOfOnes,, etc.  I supposed I need to set numberOfOnes to zero before anything, since there's no way I see to decrement numberOfOnes.


      Any suggestions?