An associative array IS an Object.
If order does not matter, use a for..in loop to build the ArrayCollection. If it does, well, use XML. Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Monday, March 19, 2007 3:59 PM To: [email protected] Subject: RE: [flexcoders] Cast Object (Assoc Array) to Array Collection... Doubt it. How would it know what order? How do you know the order? You could make a custom assocarraycollection. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Sent: Monday, March 19, 2007 12:44 PM To: [email protected] Subject: [flexcoders] Cast Object (Assoc Array) to Array Collection... i just ran into a problem where I am sending back a list of Objects from the server. Originally everything was working fine since the objects were sent as a standard Array with internal objects retrievable as myArray[0], myArray[1],myArray[2],myArray[3] However, for other reasons, I am now sending the values back as an associative array myArray['id1'], myArray['id23'],myArray['id30'],myArray['id5'] Now when I try to cast it as an Array to put into and ArrayCollection it turns to NULL. Flex is seeing it as an Object when it comes from the server (probably because AMFPHP conversion is telling it that.) Then when I try to cast this "Object" as an Array it NULL's it. I guess here are my options: Is there a way to cast an Object (associative array) as an Array? OR Is there a way to force AMFPHP to return the assoc array as an Array (or ArrayCollection) and not an object? OR Is there an efficient way to convert an object into an ArrayCollection? I will post this to the flexcoder list as well since I know you are not a familiar with AMFPHP. Thanks, Kevin

