Need to correct (add) one line. Forgot to add the cursor.moveNext():
var cursor:IViewCursor = myAC.createCursor();
var sumPop:int = 0;
var myObject:Object;
while (!cursor.afterLast) {
myObject = cursor.current;
sumPop += myObject.population;
cursor.moveNext();
}
Jurgen Beck wrote:
Just another option:
var total : Number = 0;
for each (var obj : Object in myAC) {
total += obj.population;
}
R.
On 6/3/07, Jurgen Beck <[EMAIL PROTECTED]> wrote:
Hi Todd,
One of the ways would be to traverse your ArrayCollection with a cursor:
var cursor:IViewCursor = myAC.createCurs
Hi Todd,
One of the ways would be to traverse your ArrayCollection with a cursor:
var cursor:IViewCursor = myAC.createCursor();
var sumPop:int = 0;
var myObject:Object;
while (!cursor.afterLast) {
myObject = cursor.current;
sumPop += myObject.population;
}
Jurgen
todd_geist wrote:
Hell
Hello,
Very new here. Trying to get some of the basics. I have datagrid
that is populated with the following arrayColleciton
How do I go about getting the sum of the population?
Thanks in advance for any advice
4 matches
Mail list logo