Skip to content


Flex Associative Array with an Indexed Array

The associative array are the stock names and the items are representing the indexed array.

var stockDetails:Object = new Object();
stockDetails["AAPL"] = ["+5", "152 Change"];
stockDetails["MCSFT"] = ["-20", "-10 Change", "Another Item"];

Reading the array, you can use a for loop

for ( var stock:String in stockDetails )
{
	trace ( stock + " -> " + stockDetails[stock] );
}

/* Trace:
----------------------
AAPL -> +5,152 Change
MCSFT -> -20,-10 Change,Another Item
*/

Posted in Flex Web Development.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Chris Wyatt says

    Thanks! Nice and simple, just what I was looking for.



Some HTML is OK

or, reply to this post via trackback.