Binding XML data to dynamic text inside MC

Hello all,

I am having issues binding some XML data that I am looping through to a MC. Imagine if you will about 100 MCs on the stage, each with incrementing numbers in their instance names (ie. mc_locker1, mc_locker2, mc_locker3…). I want to be able to loop through the XML, then bind that data to the corresponding MC. Here is a snippet of code thus far:

function loadXML(loaded) {
if (loaded) {
id = [];
usage = [];
totalLength = this.firstChild.childNodes.length;
for (x=0; x<totalLength; x++) {
id[x] = this.firstChild.childNodes[x].childNodes[0].firstChild.nodeValue;
usage[x] = this.firstChild.childNodes[x].childNodes[1].firstChild.nodeValue;

this works —> mc_locker1.unique_txt.txt = id[x];
this does not but needs to —> someVariableName+x.unique_txt.text = id[x];

}
}

The problem is that I have to specifically assign the MC instance name (mc_locker1) to the data binding. But remember I have over 100 MCs on the stage so that would be silly. I need a way to set up a variable so that I can concatenate the string and then loop accordingly (ie. lockers = “mc_locker” + (x+1) + ".unique_txt.text) but that does not work.

Is there an issue with not being able to access attributes when a variable is used?

Any help would be appreciated.

Thanks.