PDA

View Full Version : How to utilize new XML(loader.data)?


djliquidice
08-16-2006, 12:29 AM
Hi fellas,

I'm trying to get a datagrid.dataProvider to be the result of a URL. The alert.show function shows me the data, but it's just a string. Is there a way to convert the data from XML to an array so that the datagrid can read? Thanks in advanced. This place pwns.

public function getData():void {
var evtLoader:URLLoader = new URLLoader();
var evtRequest:URLRequest = new URLRequest("php.functions/open_events_xml.php.xml");

evtLoader.load(evtRequest);
evtLoader.addEventListener("complete", onComplete);
}

public function onComplete(event:Event):void {

var evtLoader:URLLoader = URLLoader(event.target);
evtXML = new XML(evtLoader.data);
Alert.show(evtXML.toString());
evtViewer.dataProvider=evtXML;
}

djliquidice
08-16-2006, 12:31 AM
I've tried var evtArray:Array = new Array(evtLoader.data); but no dice.

djliquidice
08-16-2006, 12:37 AM
N/m i need ot search this forum before i post. :(

flexy
08-21-2006, 08:13 AM
Use the HTTPService object to load the XML data as an object, the data will have it's hierarchy maintained.

OR, rather than using the URLLoader object, use the load property of the XML object.