[F8] Quicker way to write these button actions
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:
PHP Code:
var buttons = "1","2","3"...."29","30";
And the buttons i'm trying to create would look like:
PHP Code:
button1.onRelease = function (){
button1.gotoAndStop("selected");
}
button2.onRelease = function (){
button2.gotoAndStop("selected");
}
button3.onRelease = function (){
button3.gotoAndStop("selected");
}
But i want to achieve this in 2 lines, something like this
PHP Code:
['button' + [buttonVariable]].onRelease = function(){
['button' + [buttonVariable]].gotoAndStop("selected");
}
Can anyone help?