How can I set the variable in currItem.onRelease = function() according to the for loop? Cause, what it does is actually on click on any of the buttons, it will return me the last value of the loop. Meaning if on click on any of the buttons say if there are 8 buttons, and button1 has var = 1, button2 var =2 and so on, I clicked on any of the buttons, it returns var = 8 for all. How can I make it such that on click button1 return 1, button5 return 5 and so on?
for (var i = 0; i<numBtns; i++)
{
currItem = currMenu.attachMovie(“menuBtn”,“btn” + i + “_mc”, i + 1);
currMenuTitle = menuTitle.attachMovie(“menuNameMC”,“title”,0);
currMenuTitle._x = 100;
currMenuTitle._y = 100;
currMenuTitle.menuName.text = recData.MuscleDesc0;
currItem._x = x;
currItem._y = y + i*currItem._height;
currItem.trackAsMenu = true;
btnName = eval(“recData.Name”+i);
currItem.btnName.text = btnName;
currItem.onRelease = function()
{
myVar = i;
}
}