Hi Cor, I appreciate your help on this. :)
On Wed, Jun 8, 2011 at 11:43 AM, Glen Pike <g...@engineeredarts.co.uk>wrote: > Hi, > > You should be able to do: > > var children:XMLList = xmlData.children(); > foreach(var child:XML in children) { > trace(child.toXMLString()); > } > > make sure you use toXMLString for tracing XML elements - otherwise you end > up with "blanks" sometimes. > > Glen > > > On 08/06/2011 16:28, ACE Flash wrote: > >> thanks Cor, I have already tried this and it returned nothing as well. >> It's >> very weird!. >> >> I was able to retrieve the length by this, it returned 3. >> >> trace(xmlData.asset.length()); >> >> >> >> On Wed, Jun 8, 2011 at 11:17 AM, Cor<c...@chello.nl> wrote: >> >> Try this: >>> >>> trace(xmlData.asset[i]); >>> >>> >>> instead of trace(xmlData.children()[i]); //<<=== but I can;t get each >>> node >>> here... >>> >>> Groeten, >>> Cor van Dooren >>> www.codobyte.com >>> ------------------------------------------------------------------ >>> "There are only 10 types of people in the world: >>> Those who understand binary and those who don't." >>> >>> >>> -----Original Message----- >>> From: flashcoders-boun...@chattyfig.figleaf.com >>> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of ACE >>> Flash >>> Sent: woensdag 8 juni 2011 17:10 >>> To: Flash Coders List >>> Subject: [Flashcoders] reading a very simple XML file >>> >>> Hi guys, I am pulling out my hair :(, my code can retrieve the xml file >>> without any problem. But I was not able to retrieve each node in the >>> follow >>> case. >>> >>> Would you please help me to take a look my code? am I mising somehing? >>> >>> Cheers >>> >>> ===== XML FILE==== >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> <root> >>> <asset type="IMAGE" url="www.google.com" filename="googlefilename" >>> size="1000"/> >>> <asset type="IMAGE" url="www.yahoo.com" filename="yahoofilename" >>> size="1200"/> >>> <asset type="IMAGE" url="www.bing.com" filename="bingfilename" >>> size="1100"/> >>> </root> >>> >>> >>> ===== AS3 ======== >>> >>> import flash.events.Event; >>> var loader:URLLoader = new URLLoader();var request:URLRequest = new >>> URLRequest("test.xml");var xmlData:XML;var childLength:uint; >>> loader.addEventListener(Event.COMPLETE, >>> completeHandler);loader.load(request); >>> function completeHandler(e:Event):void{ >>> xmlData = XML(e.target.data); >>> childLength = xmlData.children().length(); >>> >>> //trace(xmlData.children()); //<<== I can retrieve the data here >>> >>> for (var i:uint = 0; i< childLength; i++) >>> { >>> trace(xmlData.children()[i]); //<<=== but I can;t get each >>> node here... >>> } >>> } >>> >>> >>> ======= code online ===== >>> >>> http://www.privatepaste.com/89e38a7292 >>> _______________________________________________ >>> Flashcoders mailing list >>> Flashcoders@chattyfig.figleaf.com >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>> >>> _______________________________________________ >>> Flashcoders mailing list >>> Flashcoders@chattyfig.figleaf.com >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>> >>> _______________________________________________ >> Flashcoders mailing list >> Flashcoders@chattyfig.figleaf.com >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> >> > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders