Wednesday, 28 August 2013

AS3: Toggle button with Button symbol

AS3: Toggle button with Button symbol

Firstly, I have seen many threads about this question but all was about
create Toggle button in MovieClip not in Button symbol. I've created
Button symbol in Flash Pro. I defined Up And Over And Down specific states
for each of those.
The question is :
How can i create a toggle button with Button symbol.
P.S :
I'm not talking about create that via MovieClip, i can do it through
MovieClip but i need to do that via Button symbol. Like below :
(MovieClip)
var flag:Boolean = false;
myBtn.stop();
myBtn.addEventListener(MouseEvent.CLICK, clicked);
function clicked(evt:MouseEvent):void {
if (flag) {
myBtn.gotoAndStop(1);
} else {
myBtn.gotoAndStop(2);
}
flag = !flag;
}
Any ideas would be appreciated.

No comments:

Post a Comment