This is just a simple problem that has annoyed me for hours. I want to get data from my XML file an store them in arrays but it doesnt!! Why??
My script:
//XML function
function loadXML(loaded) {
var headline_temp:Array = [];
var text_temp:Array = [];
if (loaded) {
for (i=0; i<5; i++) {
headline_temp* = this.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
text_temp* = this.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
}
} else {
trace("file not loaded!");
}
}
//////////////////////////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("extern/text.xml");
If I trace the arrays, it just returns ‘undefined’ but if I trace inside the function it returns the actual data. Why??