I am working on a Flash AS2 script that adds an instance of a movieclip for each node in an XML file. I have also included titles for each node in the XML file and I would like to display these when a user clicks on one of the individual movieclips. I have played around with clipevents and attachMovie but for the life of me I can't figure out how to approach this problem. Any ideas?
Ok Now with update script - yea!
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 pinNumber = i+1;
_root.attachMovie("box", "pin"+i, _root.getNextHighestDepth());
var xpos = Number(myPin[i].attributes["xpos"]);
var ypos = Number(myPin[i].attributes["ypos"]);
_root["pin" + i]._x = xpos;
_root["pin" + i]._y = ypos;
_root["pin" + i].popup.titleBox.text = myPin[i].firstChild.nodeValue;
_root["pin" + i].popup._visible = false;// hide the title to begin with
_root["pin" + i].onRelease = function () { //when the pin is clicked...
_root["pin" + i].popup._visible=!_root["pin" + i].popup._visible; //toggle the titleBox's visibility
}
}
}
};