Hve you considered using XMLListCollection?  It has all the benefits of
a collection, retains the benefits of e4x expressions, and is easily
created from XMLList:

Var myDP:XMLListCollection = new
XMLListCollection(xmlData.partsList.catalog);

 

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Schmalle
Sent: Thursday, January 25, 2007 8:34 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: How to convert XMLList Collection to an
ArrayCollection ?

 

Hi,

I don't think you can...

In the help docs they have this example

for each (var item in doc.p) 
{ 
   trace(item); 
}

I would say you are going to have to bite the bullet and loop.
ArrayCollection is just a wrapped array and I don't see any  place where
XMLList returns and array. It's like mixing apples and oranges. 

Although XMLList looks like an array it isn't.

Peace, Mike

On 1/25/07, Danko Kozar <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Have you tried: 

myDP = xmlData.partsList.catalog as ArrayCollection;

?

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "helihobby" <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I have XML data which comes back from a server via a custom socket.
> How can I convert that the to an ArrayCollection ?
> 
> If I try:
> 
> myDP = new ArrayCollection(); 
> myDP = ArrayCollection(xmlData.partsList.catalog);
> 
> I get a runtime error the XML List collection can not be converted 
to 
> an array collection.
> 
> I know I can do a for loop and re-build it but I was wondering if 
there 
> is a quick qay to do it.
> 
> I know the HTTPService can do it with the result inline tag which 
will 
> convert the XML data to an Array Data provider but I am not using 
it. I 
> am using Sockets.
> 
> Thank you for all the help,
> 
> Sean.
>




-- 
Teoti Graphix
http://www.teotigraphix.com <http://www.teotigraphix.com> 

Blog - Flex2Components
http://www.flex2components.com <http://www.flex2components.com> 

You can find more by solving the problem then by 'asking the question'. 

 

Reply via email to