Hello
I have the following simple action script file xmlLoader.as
It has on XML variable and its constructor takes as an argument a string
wich represents the path for the xml file so it defines a URLLoader loads the xml file and stores the data on the XML variable.
I have realized that the eventlistener function onloadXml it does not executed.
Thank you
package {
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class xmlLoader {
private var xml:XML;
public function xmlLoader(xmlDocument:String):void {
var loader:URLLoader = new URLLoader();
loader.addEventListener( Event.COMPLETE, onloadXml);
loader.load(new URLRequest(xmlDocument));
}
public function onloadXml(e:Event):void {
this.xml = new XML(e.target.data);
}
public function getXML():XML {
return this.xml;
}
}
}
import xmlLoader;
import flash.events.TimerEvent;
var path:String = “images.xml”;
var myLoader = new xmlLoader(path);
var xml = myLoader.getXML();
trace(xml); //// null ???