PDA

View Full Version : Attaching movieclips with XML



fangonk
February 22nd, 2010, 03:30 AM
Hi, Im trying to build a script that attaches and positions an instance of a movieclip for each node of an xml sheet. However, I can't seem to get it to loop properly. The script is simply attaching and positioning the movieclip according to the last node in the xml file. Can anyone tell me what I am doing wrong?!!

Here is my script:


var myXML:XML = new XML();
myXML.ignoreWhite=true;
myXML.load("map.xml");
myXML.onLoad = function(success) {
if (success) {
var myPin = myXML.firstChild.childNodes;
for (i=0; i<myPin.length; i++) {

var imageNumber = i+1;

_root.attachMovie("box", "pin"+i, _root.getNextHighestDepth());
var xpos = myPin[i].attributes.xpos;
var ypos = myPin[i].attributes.ypos;
_x = xpos;
_y = ypos;

}
}
};

fangonk
February 22nd, 2010, 03:37 AM
Woops got. Thanks anyways.