I can’t figure out why this doesn’t work. I need to pass the text in the xml file to an object that needs to be created outside of the onload function so i need access to the data out side of that function. I’ve declared variables to store the data at the class level which i thought would give me access to the data
please help.
below is the code:
package {
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.xml.*;
public class Test extends MovieClip {
private var tlbXML:XML;
private var tlbNode3:String;
public function Test() {
init();
}
function init(){
var tlbLoader:URLLoader = new URLLoader();
tlbLoader.load(new URLRequest("tlbContent.xml"));
tlbLoader.addEventListener(Event.COMPLETE, processTlbXML);
}
function processTlbXML(e:Event):void {
var tlbXML = new XML(e.target.data);
tlbNode3 = tlbXML.tlb.node3.toString();
//trace works here
trace(tlbNode3 + " = tlbNode3");
}
//trace doesn't works here
trace(tlbNode3 + " = tlbNode3");
}