flash.utils.Dictionary also seems like a reasonable response to this problem.
On Mon, Jan 26, 2009 at 10:55 AM, Scott Talsma <[email protected]>wrote: > Corey, > > Associative Arrays are essentially the same thing as Objects > (ok--ObjectProxy for the sticklers). Why don't you consider using > that instead? That way you can use the properyList() fn which returns > a list of property names. > > You may need to stick an object into the value position behind those > key names, but that should be too difficult. You would however have > to write a translation method if you are getting all this data from a > server. > > On Mon, Jan 26, 2009 at 10:17 AM, Corey Osman <[email protected]> wrote: > > Hey, > > Ok so here is my problem. I have an array collection which is an > > associative array (keys/values) and I want to get the key name from each > > position in the loop. This is easily done in python using myarray.keys() > or > > myarray.values() which will return a list. My problem is I can't find a > > similar method to do this in flex. Flex assumes that I already know the > key > > in order to get the value. However, I don't know the keys because they > are > > dynamic (they were loaded from a file that the user made) > > > > > > This is a python list of dictionaries, but its the same format as a > > associative array collection > > [ > > {'command': 'dccmd capture server', '--slotid': 'OEM:01'}, > > {'command': 'dccmd deploy server', '--slotid': 'OEM:01', '--repo': > > 'nfs://pathtorepo'}, > > {'command': 'ridleserver', '--slotid': 'OEM:01'}, > > {'command': 'rshowslot', '--slotid': 'OEM:01'} > > ] > > > > However keep in mind that from the list above I am only using one item at > a > > time. > > var pos:int = commands.getItemIndex(cmdbox.selectedLabel); > > var args:ArrayCollection = ArrayCollection(ArrayUtil.toArray( > > cmdlist.getItemAt(pos) )); > > > > Now I wish to use a for loop over the number of "keys" in the > > arraycollection (should loop 2-3 times) > > -- then get the name of each key > > -- then pass that name to another function that does cool stuff > > > > > > Any ideas? > > > > Corey Osman > > ------------------------------------------------------------- > > To unsubscribe from this list, simply email the list with unsubscribe in > the > > subject line > > > > For more info, see http://www.affug.com > > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > > List hosted by FusionLink > > ------------------------------------------------------------- > > > > -- > Scott Talsma > CTO, echoEleven > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in > the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > >
