var bravo = new Array;
bravo = ["dan.xml", "scott.xml", "james.xml", "paul.xml", "jen.xml", "tom.xml"];
makeTheChange(bravo);
function makeTheChange(arry){
for (var d = 0; d<arry.length; d++) {
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (status)
{
if (status == true){
imgData = imgXML.firstChild;
theChilds = imgData.childNodes;
for (var i = 0; i<theChilds.length; i++) {
if (theChilds*.nodeName == "record") {
arry[d] = theChilds*.firstChild.attributes.age;
}
}
}
else if (status == false){
trace ("Problem: XML didnt load");
}
trace(arry[d]) /*Here is the problem, its always undefined except for the last element, which gets the change*/
};
myXML.load(arry[d])
}
}
I’ve got a small problem here. Basically I have an array with xml files. What I want to do is load each xml file, then parse through the data and change the current index value for a value in the xml file, move to the next element. But for some reason at that trace that I have I’m getting undefined values for all elements except for the last one which properly changes its value. Is there something I’m doing wrong?? I think my logic is correct.
before the function makeTheChange executes, the array bravo looks like this
bravo = [“dan.xml”, “scott.xml”, “james.xml”, “paul.xml”, “jen.xml”, “tom.xml”];
after makeTheChange executes I want it to look like this (these are node values in each xml respective xml file)
bravo = [“23”, “44”, “54”, “35”, “31”, “39”];
thanks for your help