I am used to using mc’s as buttons now and scripting them accordingly.
E.g.
btn_1.onPress=function(){
gotoAndPlay();
}
Now, I am making a lot of buttons that exist at the same time, so I want the buttons that aren’t curently active to be disabled, so I script like this, FOR EACH BUTTON:
My problem is, I am in situation where I have up to 15 buttons and I find I have to script each one which means I am having to type an enormous amount of code. I simple do not know how to economise my AS. Top that off with the fact that each button must also have a gotoAndStop function added and I am ending up with 300 + lines of code!! Just for the buttons!!
Can someone help me find a way to write a compact script for this situation??
the ones i like (dont know why) are for loops for example
[AS]
//this loop will cycle throuhg btn_0, btn_1… til 14
for(var i=0; i<15; i++){
//here assign properties, for example this will unable all buttons
this[“btn_”+i].enabled=false
}
[/AS]
Thankyou both for such prompt and ultimately useful replies!!
Particular thanks to Claudio. With a little modification, this script does exactly what I want. All I have to do now is try to understand how it works!!! :]
To Flash4Food. I already tried using a ‘loop’, but I could not seem to get the buttons to ‘reset’ once you had clicked on another one… Maybe I will look into it later when I have a spare 5 minutes ( an hour or two more like]