+1

Looping over objectElements in an arraycollection

Flex, CFML, Actionscript
I asked a simple question on flexcoders today:
I have a simple array collection.  Ie. a ColdFusion query being passed back to Flex  eg:
select  firstName, lastName, age
from    person
So in flex it's:
Ac[0].firstName = Paul  ect
But I don't know ac[0].columName  so is there a way to loop over the properties of the object at ac[0]?
 
Thanks to Fotis Chatzinikos who game me this answer.
for (var key:String in object)
{
    data = object[key] ;
}

where object is your arraycollection item ie. ac[0]
 
This was a simple solution that I just overlooked.  I’m going to mock up an example of what I was using this for in the next few days.

Search