Xml files and array?

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

anyone can think of a better way to do this?? At the end of the day I’m looping through an array that contains xml files paths and I basically want to extract some data from each file and store it in another array

thanks

why have you got so many different xmls?

its just the way my data is set up, in numerous xml files. So I went ahead and placed them in an array, all I want to do is to be able to loop through the array and grab stuff from the xml files. That code I have above is the only solution I could have thought of.

would there be another way to do this?

I dont know a fix right off the top of my head, but the reason your last one is reading in is because it was the last one in the loop. Somehow the values are getting over-written each time it loops.

you may want to stick a control function in, instead of a for loop

ie, run first array item, finish, increment and then run again.

for loops in for loops generally muck up