Hey,

Thanks for all the suggestions. I starting reading up on the dictionaries and looping over with objects. I think the source of my problem is that since I am getting data via xmlrpc I need to use the IXMLRPCStruct Interface. Since I am passing a list of dictionaries from python, xmlrpc converts that to a stuct of some type. So I'll need to use this interface to convert it to the datatype of choice (hash table).



package com.ak33m.rpc.xmlrpc
{
        public interface IXMLRPCStruct
        {
                function getPropertyData ():*;
        }
}


corey

On Jan 26, 2009, at 11:43 AM, Douglas Knudsen wrote:

Interestingly the docs say not to use Array for associative purposes, though it is possible, just not practical it seems now.
http://livedocs.adobe.com/flex/3/langref/Array.html

Also note you can loop over the items in Object and get keys or values via the two different for loops: "for..in" and "for each"
See: 
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7fcf.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7f59

DK

Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


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
-------------------------------------------------------------







-------------------------------------------------------------
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
-------------------------------------------------------------

Reply via email to