flash actionscript:
[quoted text, click to view] "Josh Pratt" <webforumsuser@macromedia.com> wrote in message news:ebg860$npj$1@forums.macromedia.com...
> I've got a menu I'm programing, but I am starting to forsee it being a lot of
> code.. Is there a way to cut down this code specifically? I've got it so that
> the alpha level of a button goes down to 60 onRollOver and the alpha goes back
> to 100 onRollOut. Is there a better way to do this?
If you want to assign button actions in a loop you can use numbered buttons like btn1, btn2 etc. or you can use an array of button
names in the loop.
Unless you are planning to make a lot more things happen with the buttons it doesn't seem worth all the trouble. If you just want
to make some common rollover and rollout actions you can make a function that all buttons can use by sending their instance names to
the function like this..
// buttons
//-----------------------------------
calendar.onRollOver = function() {
rollOverStuff(this);
}
//-----------------------------------
calendar.onRollOut = function() {
rollOutStuff(this);
}
//-----------------------------------
// common functions
//-----------------------------------
function rollOverStuff(btn)
{
btn._alpha = 20;
btn._y = 55; // button drops down a little
}
//-----------------------------------
function rollOutStuff(btn)
{
btn._alpha = 100;
btn._y = 50; // button back up
}
//-----------------------------------
tralfaz