import flash.events.Event;
var clicked = false; //Make a variable that stores the current state.
button_mc.addEventListener(MouseEvent.CLICK, toggleState);
function toggleState(e:Event){
clicked = !clicked; //Toggle the current state
(clicked) ? button_mc.gotoAndPlay(2) : button_mc.gotoAndPlay(1);
//if clicked is true, go to the clicked frame in the button
//(you might have flags, in which case, name them in quotes,
//butt_mc.gotoAndPlay("clicked")), otherwise go to the first
//frame (which should be the upstate)
}
How make a button stay in over or down state when clicked?
-
01-07-2022 - |
Domanda
How do I make a button stay in its down or over state when clicked, and then back to its up state when clicked again?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow