# Externally loaded XML variables

**URL:** <https://forum.kirupa.com/t/externally-loaded-xml-variables/262328>\
**Category:** flash\
**Created:** [June 5, 2008, 2:53am UTC](https://forum.kirupa.com/t/externally-loaded-xml-variables/262328 "2008-06-05T02:53:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![le\_architect](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/le_architect/32/3934_2.png) [@le\_architect](https://forum.kirupa.com/u/le_architect)\
**Post date:** [June 5, 2008, 2:53am UTC](https://forum.kirupa.com/t/externally-loaded-xml-variables/262328/1 "2008-06-05T02:53:46Z")

</div>

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
