Re: [flexcoders] summing a value in an arrayCollection?

2007-06-03 Thread Jurgen Beck
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:

Re: [flexcoders] summing a value in an arrayCollection?

2007-06-03 Thread Roman Protsiuk
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

Re: [flexcoders] summing a value in an arrayCollection?

2007-06-02 Thread Jurgen Beck
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

[flexcoders] summing a value in an arrayCollection?

2007-06-02 Thread todd_geist
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