Flash switch button

I need a button in Flash / AS3 that turns on and off. Therefore, I was glad to see that the class Buttonhas toggle, which allows me to have this behavior. I was less pleased to see that what I get when I do something β€œbutton” in a Flash file is an instance of a SimpleButtonclass that does not have this parameter.

Is there a way to get a Button instance from .fla or make SimpleButton behave like a switch?

+3
source share
3 answers

This is how I encoded my path:

private buttonState:Boolean;

private function buttonToggle(button:SimpleButton){
    var currDown:DisplayObject = button.downState;
    button.downState = button.upState;
    button.upState = currDown;
    buttonState = !buttonState;
}

private function clickEvent(e:MouseEvent){
    buttonToggle(e.target);
}

clickEvent, .

+6

"". , ?

+1

Source: https://habr.com/ru/post/1703417/


All Articles