I am using a dynamic nav menu edited using xml, when the corresponding button is pressed I want it to display some text in the text box and load a .swf into the loader m.c. It sort of works, however which ever button i click on it displays the content text and .swf for the last button listed in the xml file, when I try to set a var equal to the instance name of the button clicked on it shows the text as undefined and does not load the m.c? If i leave out the var ‘currentIndex’ I get a message in the output Error opening URL file undefined. I’ve checked everything and there are no typos. Really need some help here.
Thanks
code;
var yPosition:Number = 0;
var myXML:XML = new XML();
myXML.ignoreWhite = true;
var links:Array = new Array();
var names:Array = new Array();
theText._alpha = 0;
empty._visible = false;
myXML.onLoad = function(){
var linkname:Array = this.firstChild.childNodes;
for(i=0;i<linkname.length;i++){
names.push(linkname*.attributes.NAME);
contents = linkname*.attributes.CONTENT;
movies = linkname*.attributes.MOVIE;
_root.attachMovie("button","btn"+i,_root.getNextHighestDepth());
_root["btn"+i]._y = yPosition;
yPosition = yPosition + 25
_root["btn"+(i)].blackTxt.Txt.text = (names*);
_root["btn"+(i)].whiteTxt.Txt.text = (names*);
_root["btn"+(i)].onRollOver = btnOver;
_root["btn"+(i)].onRollOut = btnOut;
_root["btn"+(i)].onRelease = btnRelease;
}
}
myXML.load(“projects.xml”);
function btnOver(){
this.gotoAndPlay(2);
}
function btnOut(){
this.gotoAndPlay(11);
}
function btnRelease(){
var currentBtn:String = this._name;
var currentIndex:String = currentBtn.substring(3,5);
theText._alpha = 100;
theText.text = contents;
empty._visible = true;
empty.loadMovie(movies[currentIndex]);
}