Please help me. I'm new to AS3 and thought I could just wing it. Obviously not. This is ridiculous and I've been at this for an embarrassingly long number of hours and hours.
I'm just trying to pass a value from a function to a global variable; or a variable on the main timeline; or whatever I call it now.
Please don't berate me for using a global variable. I understand it is bad, but I'm just trying to finish this project and I don't really care right now.
I need to edit the values of categoryArray and songArray from within the function. I also need to edit the value of mySongsDir. I would pass the arrays to the function, or return my values as an object, but I don't think I can!Code:var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); var categoryArray:Array = new Array(); var songArray:Array = new Array(); var mySongsDir:Object = new Object(); var mySongsDir:String = new String(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("mySongs.xml")); function LoadXML(e:Event):void { xmlData = new XML(e.target.data); ParseSongs(xmlData); } // function ParseSongs(songInput:XML):void { // mySongsDir = songInput.attribute("filedir").toString(); // ... blah blah blah... rest of function... }
_root - No!
_global - No!
This is such a simple task... I just want to pass values to the variables in _root. *sob*
How do I do it?




Reply With Quote