Here's a sample xml that's getting loaded in via http service:

<images duration="3000" effect="Fade" startDelay="2000">
        <image name="image.jpg" url="http://www.cnn.com"/>
        <image name="image1.jpg" url="http://www.usatoday.com"; />
        <image name="image2.jpg" url="http://www.msnbc.com"; />
        <image name="image3.jpg" url="http://www.digg.com"; />
        <image name="image4.jpg" url="http://www.google.com"; />
</images>

If I change the code in the result handler to:

var ac:ArrayCollection = ResultEvent( data ).result.images.image

Then I have no issues putting it directly into an array collection.
It's only when I remove the (.image) and have the following:

var ac:ArrayCollection = ResultEvent( data ).result.images

Is when I get the coercion error. Is there any reason why I shouldn't
continue to put the data in an array collection via the 1st method?

TIA

--- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> You're getting an ObjectProxy because you're using the "object" result
> format. To convert to ArrayCollection:
> 
> var myArray:Array = [];
> for each (var img:* in result.images)
> {
>     myArray.pish(img);
> }
> 
> myCollection = new ArrayCollection(myArray);
> 
> -Josh
> 
> On Thu, Jul 10, 2008 at 1:31 PM, sdl1326 <[EMAIL PROTECTED]> wrote:
> 
> > Thanks for the assistance.
> >
> > I have left the resultformat blank (feel free to share why I shouldn't
> > do this as I am always looking for best practices/advice). However,in
> > previous projects, I have taken the return data from an http service
> > and immediately put it in an arraycollection in the resulthandler. I
> > just assumed the same could be done here when using Cairngorm, but
> > apparently something isn't correct. I tried your suggestion below and
> > am still receiving an error:
> >
> > TypeError: Error #1034: Type Coercion failed: cannot convert
> > mx.utils::[EMAIL PROTECTED] to Array.
> >
> > Thanks in advance.
> >
> >
> >
> 
> -- 
> "Therefore, send not to know For whom the bell tolls. It tolls for
thee."
> 
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>


Reply via email to