XML: looping sickness

hi everyone! i must be out of my mind and cant find the problem: here is the script:

roleSelect = new XML();
roleSelect.ignoreWhite = true;
roleSelect.onLoad = function(success) {
if (success) {
roleLists = roleSelect.childNodes;
hyt = 40;
for (x=0; x<roleLists.length; x++) {
item = attachMovie(“tpLists”, “tpLists”+x, x);
item._x = 0;
item._y = hyt;
hyt += 40;
item.count.text = x+1;
item.courses.text = roleLists[x].attributes.name;
item.lessons.text = roleLists[x].attributes.lessons;
item.quizzes.text = roleLists[x].attributes.quizzes;
item.runTime.text = roleLists[x].attributes.runTime;
if (roleLists[x].attributes.cType == “SCORM”) {
tracer = new XML();
tracer.ignoreWhite = true;
tracer.onLoad = function(success) {
if (success) {
trace(“if SCORM, trace this”);
[color=Red]//Problem is here: why does the trace goes to the last item even if the valid item is the first?[/color]
traceNodes = tracer.firstChild.childNodes;
for (xx=0; xx<traceNodes.length; xx++) {
findLink = traceNodes[xx].nodeName;
if (findLink == “resources”) {
item.link.text = traceNodes[xx].firstChild.attributes.href;
}
}
}
};
tracer.load("…/Courses/"+roleLists[x].attributes.name+"/imsmanifest.xml");
}else{
item.link.text = “”;
}
}
}
};
roleSelect.load(“TrainingPlan.xml”);

Geez… i dunno how to explain this :hangover: