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.





--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> You can't cast ("as") unless the variable is an object that contains an
> instance of what you are casting to.  HTTPService will not be returning
> an ArrayCollection.  It is probably an Array, assuming you have left the
> resultFormat at its default "object". (this is usually bad, but that is
> a different story)
> 
>  
> 
> You probably want something like:
> 
> var aResult:Array = ResultEvent( data ).result.images;
> 
> trace(aResult.length); //what you expect?
> 
> var ac:ArrayCollection = new ArrayCollection(aResult);
> 
>  
> 
> Tracy
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, July 09, 2008 8:00 PM
> To: flex
> Subject: [flexcoders] Putting returned xml data into ArrayCollection
> using Cairngorm framwork (Command Class/Delegate Class/IResponder)
> 
>  
> 
> I am using an httpService to grab some xml data. Using the Cairngorm
> framework, I have the results sent back to the Command Class
> (implementing IResponder) from the Delegate Class. As simple as this
> might sound, it's frustrating me beyond belief ... what's the simplest
> way to put the returned data into an array collection? If I trace out
> the returned data (see code), I get an object. However, if I attempt to
> put the returned data in an object, it traces out 'null'.
> 
> public function result(data:Object):void{            
>             
>             trace(ResultEvent( data ).result.images) // traces object
>             var ac:ArrayCollection = ResultEvent( data ).result.images
> as ArrayCollection
>             trace(ac) // traces null
> }
> 
> Can someone shed some light on the error of my ways?
> 
> Thanks in advance.
>


Reply via email to