2 Replies Latest reply on May 27, 2009 11:14 AM by rcanulla

    Changing Values in ArrayCollection

    rcanulla Level 1

      Hi there,


      I have an array collection that is populating a chart here in flex. I want to know how I can change index items in the AC so that I can manipulate the the chart on the fly.


      the array that is populating the chart. I am pushing in Vars as :int

               var ratingAC:ArrayCollection = new ArrayCollection([
               { Rating: 1 },  // [0] no data
               { Rating: positive }, // [1] positive rating total
               { Rating: neutral }, // [2] neutral rating total
               { Rating: negative }  // [3] negative rating total
                  private var positive:int = 0;
               private var neutral:int = 0;
               private var negative:int = 0;


      What i am asking is, how can I change the values of this AC once it is created. What I would do, is loop through the user feedback, and update the AC @ ratingAC[1].methodToUpdate(). I would need to pass in a var as an int into the array. I would want to ge the current number from the array[1] and add that number to a var, then push the new total back into the array at the same index position.


      Any help is much appreciated!