That only works because the default resultFormat causes Flex to cnvert
your xml into a nested structure of dynamic objects.  One result of is
is that child groups are converted to Array.

 

I advise you do not do this.  You lose the benefits of e4x expressions,
and wind up with loosely typed objects everywhere.  The conversion
always happens, so you do not gain any performance.  Also the conversion
modifies your data, turning strings into numbers where it can, and stuff
like that.  

 

You will be better served in the long run if you simply loop over the
XMLList and assign the attribute or child values to an instance of a
strongly typed value object. 

 

Tracy

 

 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of oneworld95
Sent: Tuesday, October 28, 2008 2:19 PM
To: [email protected]
Subject: [flexcoders] Re: Read XML data in as ArrayCollection

 

Never mind! Figured it out:

arrCol = event.result.premiums.premium as ArrayCollection

Also took off the resultFormat from the HTTPService call.

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "oneworld95" <[EMAIL PROTECTED]> wrote:
>
> Hi. I've got a Flex app that receives XML (resultFormat = "e4x") data
> from a servlet in this format,
> 
> <premiums>
> <premium id="ABCDEF01" startcount="0" currentcount="0">
> <category>CD</category>
> <description>The CD Description</description>
> <image id="3095">
> <filename>ABCDEF01__1225202763673.jpg</filename>
> </image>
> </premium>
> <premium id="DEFGH01" startcount="0" currentcount="0">
> <category>DVD</category>
> <description>DVD Description</description>
> <image id="3078">
> <filename>DEFGH01__1225132169948.jpg</filename>
> </image>
> </premium>
> </premiums>
> 
> I need to convert it to an ArrayCollection and then an array to
> manipulate the results (using the slice method). Any solutions?
Thanks.
>

 

Reply via email to