Using global array for XML results
I'm new in flash scripting and this is driving me crazy...
I searched the whole internet and I could not find a solution for this.
I'm trying to load XML, parse values into global array, and use that global array later in my code... this is not working.
_global.autoid=Array();
function ParsingXML(){
var pokXML:XML = new XML();
pokXML.ignoreWhite = true;
pokXML.onLoad = function(loaded){
if (loaded){
var full_niz:Array=pokXML.firstChild.childNodes;
var len:Number=full_niz.length-1//getting the no of child nodes
for(var i:Number=0;i<=len;i++)//looping trough the values
{
_global.autoid=full_niz.childNodes[0].firstChild;
}
trace(_global.autoid); //return OK array
return _global.autoid; //function output
}else{
trace("Nije OK");
}
}//end function(loaded)
pokXML.load("my.xml");
}//end ParsingXML function
ParsingXML(); //return empty array[/AS]
How do I make this work?
Sorry for my (bad) English