This is the darnest think, so why is it that one cannot set a global array in a function, ive tried many ways but nothing works... grrr, i just can't figure this out...
Code:
var xmlDoc:XML = new XML();
System.useCodepage = true;
xmlDoc.ignoreWhite = true;
xmlDoc.onLoad = function(ok:Boolean) {
if (ok) {
var num:Number = this.firstChild.childNodes.length;
var num2:Number = 0;
var test1 = this.firstChild.childNodes[0].childNodes[0].attributes.modname;
// sometimes the first value does not exist, so skip it
if (test1.length==0) {num2=1;}
var f:Number=0;
for (var i = num2; i < num; i++) {
_global.aLabels[i]= this.firstChild.childNodes[i].childNodes[0].attributes.modname;
// if i check for _global.aLabels[0] or [1] many frames
//later i get undefined.
// At this spot in this function if i:
// trace(_global.aLabels[0]); I get a value
// so why can i use the array later? Thanks
}
} else {
trace("XML did not load");
}
};
xmlDoc.load("test.xml");