Hi there, i have a little problem. I have the code below, which loads in from an xml file and makes buttons and sets variables, but when we enter a new frame for somereason the variables dissapare. how can i fix this?
//
//hide the original button
this.button_mc._visible = false;
//set the starting Y position from the first button
Ystart = this.button_mc._y;
//
//create the Array
files = new Array();
//
//create the XML
var XMLreciever = new XML();
XMLreciever.ignoreWhite = true;
//onLoad Function
XMLreciever.onLoad = function(success:Boolean) {
if (success) {
//loop thru the <buttons> nodes in the XML
for (i=0; i<this.firstChild.childNodes.length; i++) {
//enter the current name attribute of the <buttons> node into the files array
files* = this.firstChild.childNodes*.attributes.name;
//
//duplicate the button on the stage
duplicateMovieClip(_root.button_mc, "button_"+i, i);
//set the Y position of the new button
_root["button_"+i]._y = Ystart;
//Incremement the Ystart variable for the next button
Ystart += 35;
//set the text on the button
_root["button_"+i].textbox.text = files*;
//set the image variables
_root["button_"+i].image1 = this.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
_root["button_"+i].image2 = this.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
_root["button_"+i].image3 = this.firstChild.childNodes*.childNodes[2].firstChild.nodeValue;
}
}
};
//load xml file
XMLreciever.load("images.xml");
files located at http://www.zedcom.co.nz/movie3.zip
Thanks
Mattzi