tags:

views:

46

answers:

3

How to read data from XML file in flex?

+1  A: 

Use URLLoader

var ldr:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("file.xml");
ldr.addEventListener(Event.COMPLETE, onLoad);
ldr.load(request);

private function onLoad(e:Event):void
{
  var ldr:URLLoader = URLLoader(e.target);
  trace(ldr.data);//traces the string content of file
  var myxml:XML = new XML(ldr.data);
  trace(myxml.toXMLString());
}
Amarghosh
A: 

Check out the HTTPService example in Tour de Flex.

James Ward
+1  A: 
shane