you need to use onData or onLoad property to parse your XML thanks
Franck ----- Original Message ----- From: "bardo" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, August 30, 2008 10:13 AM Subject: [osflash] xml list to Array? > hi all , i have a problem that is driving me crazy ; > > I want to write a little static function to parse xml and return an > array of node i selected . It seems to work but , when i return the > array , it give me an empty one. It seems to return the array too fast , > before i fill it . im really going crazy , if anybody have suggestions... > > the class: > > package com.xmlUtils > { > import flash.events.Event; > import flash.net.URLLoader; > import flash.net.URLRequest; > import flash.xml.*; > > public class xmlReturner > { > > public static function xml2Array(urle:String , nodeSelected:String , > iteration:Boolean ):Array > { > var xmlLoader = new URLLoader(); > var xmlData = new XML(); > var a = new Array(); > > > xmlLoader.addEventListener(Event.COMPLETE, LoadXML); > xmlLoader.load(new URLRequest(urle)); > > function LoadXML(e:Event):void > { > var xmlData = new XML(e.target.data); > ParseXML(xmlData, nodeSelected); > } > > function ParseXML(Input:XML,nodeSelected:String):void > { > var parsed = new XMLList(Input.child(nodeSelected)); > > var i = 0; > for (i ; i < parsed.length() ;i++) > { > a.push(parsed[i]); > > trace(a) > } > } > return a ; > > } > > } > > > _______________________________________________ > osflash mailing list > [email protected] > http://osflash.org/mailman/listinfo/osflash_osflash.org _______________________________________________ osflash mailing list [email protected] http://osflash.org/mailman/listinfo/osflash_osflash.org
