Hi,
I switched my code from inline XML to an external load and I can not seem to figure out how to reference the loaded XML to variables that lie outside of the loading functions shown below. I have tried returns and new variable assignments but I just can’t get something that I can use in functions outside of load and parse functions. Do I have to nest all of my code inside of these functions?
I just want to create a variable (that does not exist inside another function) like the ones I was using with the inline XML; something like:
var myVariable:XML = input.item[0].@name;
Here is my existing code for the load (it traces fine)
/////////////////////////////////////////////////////////////////
var omegaURL:String = “omega.xml”;
var omegaRequest:URLRequest = new URLRequest(omegaURL);
var omegaLoader:URLLoader = new URLLoader();
var Omega:XML
omegaLoader.dataFormat = URLLoaderDataFormat.TEXT;
omegaLoader.addEventListener(Event.COMPLETE, handleComplete);
omegaLoader.load(omegaRequest);
function handleComplete(event:Event):void {
Omega = new XML(event.target.data);
parseData(Omega);
}
function parseData(input:XML):void {
trace(input.item[0].@name);
}
Thanks for any help!
Bobby