AS3 XML Loading - variable does not exist outside the loading function

Heeceveld

New Member
\[code\]//Generating menu from XMLvar linksXML:XML;var linksLoader:URLLoader = new URLLoader();var linksDB:Array = new Array();linksLoader.load(new URLRequest("menu_links.xml"));linksLoader.addEventListener(Event.COMPLETE, processXML);function processXML(evnt:Event):void { linksXML = new XML(evnt.target.data); for (var i:int = 0; i < linksXML.link.length(); i++){ var newLink:Array = [linksXML.link.@name, linksXML.link.@param, linksXML.link]; linksDB = new Array(newLink); trace(linksDB); }}trace(linksXML.*);\[/code\]Output is\[code\]Second trace: nullFirst trace: <menu> <link name="first" param="true">first.php</link> <link name="second" param="true">second.php</link> <link name="third" param="true">third.php</link></menu>\[/code\]So in my opinion flash is losing variable when exitin the function. Please help! I have no idea why this happensThanks in advance!
 
Back
Top