i'm having some issues with AS3. Pulling an array successfully from XML, but outside of the function there is no "saved" array. Tracing the array inside the function works fine.
If somebody could lend a hand that'd be great- thanks!
Merry Christmas!
AS3
var mapLocations:Array = new Array();
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);
xmlLoader.load(new URLRequest("mapLocations.xml"));
function showXML(e:Event){
XML.ignoreWhitespace = true;
var xml:XML = new XML(e.target.data);
for (i=0; i<xml.loc.length(); i++) {
mapLocations.push([
xml[0].loc[i].locname,
xml[0].loc[i].locx,
xml[0].loc[i].locy
]);
}
trace(mapLocations); // NOT BEING RETURNED OUTSIDE FUNCTION!
}