View Full Version : How do you make a switch/toggle??
Zax0r
12-01-2005, 10:28 PM
heres quick question, who do you set a button to be a toggle. Meaning, who do you set it so that when you click it once, its set down and stays down untill you click it agin and it returns to normal?
shotsy247
12-02-2005, 12:58 AM
Use a variable to tell the switch which state it should be in. On or off.
mySwitch.switched = 1 // on
mySwitch.onRelease = function(){
this.switched = !this.switched;
this.gotoAndStop(this.switched + 1);
}
Your movie mySwitch would have two frames. Frame on would be the on frame and frame two would be the off frame. Don't forget to put a stop action on frame one of the movie itself.
_t
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.