in that case, define clicked on your root timeline and refer to it in your movieclips' code as:
MovieClip(root).clicked
then any button that is clicked will set the variable and no further animation calls will take place.
and yes, generally you'd find it better to assign all of these listeners and functions from the main timeline, and you could employ a for loop to iterate through all of your buttons and add the listeners, and define your handler functions once, so you don't have to redundantly include virtually the same exact code 12 times.
Something like this:
PHP Code:
for (var i:Number = 1; i<=12; i++)
{
this["button"+i]["planet"+i+"_btn_mc"].addEventListener(MouseEvent.ROLL_OVER, playMovie, false, 0, true);
this["button"+i]["planet"+i+"_btn_mc"].addEventListener(MouseEvent.ROLL_OUT, stopMovie, false, 0, true);
this["button"+i]["planet"+i+"_btn_mc"].addEventListener(MouseEvent.MOUSE_DOWN, onDown, false, 0, true);
this["button"+i]["planet"+i+"_btn_mc"].addEventListener(MouseEvent.MOUSE_UP, onUp, false, 0, true);
}
function playMovie(e:MouseEvent):void
{
e.target.play();
}
function stopMovie(e:MouseEvent):void
{
e.target.stop();
}
function onDown(e:MouseEvent):void
{
e.target.planet_btn_clicked_mc.alpha =.4;
}
function onUp(e:MouseEvent):void
{
e.target.planet_btn_clicked_mc.alpha =0;
MovieClip(root).gotoAndPlay("btn_click_anim","Scene 1");
}




Reply With Quote
