I used the following codes to generate a set of buttons (just like the dropdown menu tutorial).
And I did a next button to go to next set of buttons as my page can display 6 buttons at one time.
What I did on next button event, i just run the attachMovie loop again to change the properties of the buttons, i.e the button name and ID. However, the loop does run and the properties are registered, but the movie clip doesn’t changed the button name and ID. It remains the same. So is there anyway to unload the previous attachMovie MCs and reattach the new MCs with the correct button names and ID up?
[COLOR=Blue]for (var i = startBtn - 1; i<endBtn; i++)
{
// create 1 menubtn graphic
currItem = currMenu.attachMovie("menuBtn","btn" + i + "_mc", i + 1);
// set the position of the 1 menubtn
currItem._x = x;
currItem._y = y + i*currItem._height;
currItem.trackAsMenu = true;
// put the btn name in, i.e menu1
btnName = eval("recData.Name"+i);
currItem.btnName.text = btnName;
// below is just basically handles mouseclick on that curr btn
currItem.exerciseID = eval("recData.ExID" + i);
currItem.onRelease = function()
{
_global.exeID = this.exerciseID;
loadMovie("Dynamic Menu 2.swf", 1);
}
}
nextBtn.onRelease = function()
{
currentPage++;
for (var i = 4; i<6; i++)
{
trace("Executing inner loop");
trace("Startbtn:" + startBtn + "Endbtn:" + endBtn);
// create 1 menubtn graphic
currItem = currMenu.attachMovie("menuBtn","btn" + i + "_mc", i + 1);
// set the position of the 1 menubtn
currItem._x = x;
currItem._y = y + i*currItem._height;
currItem.trackAsMenu = true;
// put the btn name in, i.e menu1
btnName = eval("recData.Name"+i);
currItem.btnName.text = btnName;
trace(btnName);
// below is just basically handles mouseclick on that curr btn
currItem.exerciseID = eval("recData.ExID" + i);
trace(currItem.exerciseID);
currItem.onRelease = function()
{
_global.exeID = this.exerciseID;
loadMovie("Dynamic Menu 2.swf", 1);
}
}[/COLOR]