Forum Moderators: open

Message Too Old, No Replies

Visibility on/off button

Single button for movie clip visibility

         

catcherintherye51

6:23 pm on Jul 5, 2006 (gmt 0)

10+ Year Member



Pretty sure (hope) this is a simple fix:

I have an on/off button that toggles visibility of a movie clip on the stage. Here's the current actions I have for the button:

on (release) {
if(_parent.movieclip._visible = true){
_parent.movieclip._visible = false;
}else{
_parent.movieclip._visible = true;
}
}

When I click the button the movieclip is invisible, but when I click it again the movieclip doesn't re-appear. Any ideas?

Thanks!

catcherintherye51

6:42 pm on Jul 5, 2006 (gmt 0)

10+ Year Member



Figured it out... Boy was that easy!

on (release) {
_parent.movieclip._visible =!_parent.movieclip._visible;
}

That's it!

alce

6:58 pm on Jul 5, 2006 (gmt 0)

10+ Year Member



It is actually easier than that.

The problem is in this line, which always evaluates to true:

if(_parent.movieclip._visible = true){

should be:

if(_parent.movieclip._visible == true){