XML.onLoad = function(loaded) {
if (loaded) {
buttonArray = [b,b1,b2];
d = [“d”,“d1”,“d2”,“d3”];
e = [“e”,“e1”,“e2”,“e3”];
for(n=0;n<buttonArray.length;n++) {
buttonArray[n].id = n;
buttonArray[n].onRelease = function(){
_root.attachMovie(movieArray[this.id],mArray1[this.id],n);
_root[mArray1[this.id]]._x=250;
_root[mArray1[this.id]]._y=250;
_root[mArray1[this.id]].x2.text = _root[d[this.id]] + newline + newline + _root[e[this.id]]; // adding xml values to attachmovie text
}
_root.d = this.firstChild.childNodes[0].childNodes[15].firstChild.nodeValue; //can this be looped??
_root.d1 = this.firstChild.childNodes[0].childNodes[16].firstChild.nodeValue;
_root.d2= this.firstChild.childNodes[0].childNodes[17].firstChild.nodeValue;
_root.d3 = this.firstChild.childNodes[0].childNodes[18].firstChild.nodeValue;
_root.e = this.firstChild.childNodes[0].childNodes[19].firstChild.nodeValue;
_root.e1 = this.firstChild.childNodes[0].childNodes[20].firstChild.nodeValue;
_root.e2 = this.firstChild.childNodes[0].childNodes[21].firstChild.nodeValue;
_root.e3 = this.firstChild.childNodes[0].childNodes[22].firstChild.nodeValue;
}
}
}
This is all working fine. How can I further optimized the code for last section?
I created the loop for root.d and root.e of xml using for loop and while loop but then it does not add the xml values to the attachmovie text. I don’t know why?
Any suggestion? How can I further optimize this last section code?
Anyone??