PDA

View Full Version : on and off



berdwin
November 10th, 2002, 01:46 AM
I was wondering.. out of pure curiosity..
how do you make a button so that when clicked, it makes a movie clip dissapear, though, when clicked again, makes the clip reappear? perhaps some code? yes? ok thanks :beam:

berdwin

lostinbeta
November 10th, 2002, 02:17 AM
Create a movie clip. Give it the instance name "ball" (as I did in this example, but it can be whatever, just be sure to change it in the code).

Apply this code to the button that makes it disappear

on (release) {
_root.ball._visible = false;
}

Apply this code to the button that makes it reappear

on (release) {
_root.ball._visible = true;
}

That is all there is to that.

berdwin
November 10th, 2002, 01:38 PM
I know how to do it with two buttons, but I was wondering about a one button only method.. like to toggle something on and off.

I've seen it work with the beetle sample files that come with MX where you can toggle rotation and mouse following etc.. though I don't quite understand it. :-\

berdwin

berdwin
November 10th, 2002, 01:56 PM
Nevermind! I'm a genius and figured it out myself, huzzah!! :evil: :beam:
this is how it goes:



on (release) {
myMovie._visible = !myMovie._visible;
}

=)

berdwin

lostinbeta
November 10th, 2002, 02:27 PM
Oh ok! I misread :)

Well congrats on solving your problem :)