Thank you I kinda knew about that way ;)
but if my object contains30 fields and also has a bunch of another
objects, this procedure will be painful ;)
What about this way:
public function result(event:ResultEvent):void {
var xmlS:XML = XML(event.result);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var xdoc : XMLDocument = new XMLDocument();
xdoc.ignoreWhite = true;
xdoc.parseXML(xmlS.toXMLString());
var ob:Object = decoder.decodeXML(XMLNode(xdoc.firstChild));
var feed:Album= Album(ob); // Exception here!!!!
}
But this doesn't work for me too ;)
--- In [email protected], "Derrick Grigg" <[EMAIL PROTECTED]> wrote:
>
> You can't automatically convert XML to a strong typed object. You
> should create a method in your Album class that takes an xml
> variable, and then populate the Album from there.
>
> ie
> var album:Album = new Album();
> album.setData(event.result);
>
>
> class Album
> {
> public function setData(data:XML):void
> {
> //populate the album
> }
> }
>
> Derrick
> ----------------
> Derrick Grigg
> www.dgrigg.com
>
> --- In [email protected], "lytvynyuk" <lytvynyuk@> wrote:
> >
> > Situation I have XML like that
> > <album>
> > <name></name>
> > <images>
> > <image></image>
> > <image></image>
> > <image></image>
> > </images>
> > </album>
> >
> > using HTTPService I'm getting this XML.
> >
> > I have AS Class:
> >
> > public class Album {
> > public var name:String;
> > public var images:ArrayCollection;
> > }
> >
> > straight cast like:
> >
> >
> > var album:Album = Album (event.result);
> >
> >
> > doesn't work
> >
> > Is any suggestion around this, what I do wrong, may be there are
> some
> > other way to do that
> >
> > Thank you.
> >
>