heya dude, this is something that i code loads of times at work!
the way i do it is to create easch button as a movieClip with one frame (labeled "normal) for your normal state and another (labelled "select" as your hit state)
i then using a nice for loop i assign handlers to all the buttons like so
Code:
for (var i:Number = 0; i < NumberOfButtons; i++) {
// this will assign button release events for all the buttons assuming they are called button1, button2 and so on...
this["button"+i+"_mc"].onRelease = function() {
enableAll(); // i will explain this later
this.gotoAndStop("select"); // this will send the clicked button to its selected state
.this.enabled = false; // this prevents any rollout
// put whatever you want the button to do here
}
}
you can also assign rollovers and stuff in this loop to, but you don;t need to see that here!!
the enableAll function basicly resets everything, so any button that may have been disabled and sent to the "select" frame will act normally again....i set up the enableAll() function like this....
Code:
function enableAll():Void {
for (var i:Numer = 0; i < NumberOfButtons; i++) {
this["button"+i+"_mc"].enabled = true;
this["button"+i+"_mc"].gotoAndStop("normal");
}
}
well this works a treat for me everytime!
good luck with your coding, if you need anymore hints then please ask!