Iterating through an associative array in Flex

Always use an Object() type for an associative array. Do not use the Array() form of an associative array, as it has no inherent advantages, and doesn’t work well with iteration.

Moreover, if you are trying to iterate through an associative array of type Object(), remember the following:

Does it work? (YES):

for (var key:Object in myAssocArray) { + “ = “ + myAssocArray[key]);


Does it work? (NO):

for each (var key:Object in myAssocArray) { + “ = “ + myAssocArray[key]);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s