Hi there,
I have 30 buttons, that i need to code all the same, except for changing the number.
I'm sure you can do this by using arrays or something.
so my array would look like:
And the buttons i'm trying to create would look like:PHP Code:var buttons = "1","2","3"...."29","30";
But i want to achieve this in 2 lines, something like thisPHP Code:button1.onRelease = function (){
button1.gotoAndStop("selected");
}
button2.onRelease = function (){
button2.gotoAndStop("selected");
}
button3.onRelease = function (){
button3.gotoAndStop("selected");
}
Can anyone help?PHP Code:['button' + [buttonVariable]].onRelease = function(){
['button' + [buttonVariable]].gotoAndStop("selected");
}




Reply With Quote