Binding ArrayCollection items to vars
Hi there,
I have an arrayCollection that is populating a chart. Can I bind the array items to vars that I can then modify?
private var ratingAC:ArrayCollection = new ArrayCollection([
{ Rating: 10 }, // [0] positive
{ Rating: 20 }, // [1] neutral
{ Rating: 60 } // [2] negative
]);
Rating Variables
private var positive:int = 0;
private var neutral:int = 0;
private var negative:int = 0;
Loop to update the arrayCollection
private function buildChart():void{
for(var i:int; i<newsDB.length; i++){
if(newsDB.rateItem == 0){
ratingAC.addItemAt(); // how can i add 1 to the value at index[0]?
}
if(newsDB.rateItem == 1){
neutral += 1;
}
if(newsDB.rateItem == 2){
negative += 1;
}
}
}