Table of Contents

MovieClip._visible Property Flash 4

whether a clip or movie is shown or hidden read/write
mc._visible

Description

The Boolean _visible property indicates whether mc is currently shown (true) or hidden (false). We use _visible as a quick means of hiding a movie clip or movie from view. Note that button events and the onKeyUp( ) and onKeyDown( ) event handler properties do not fire when a clip is not visible, but otherwise the clip operates as normal. It can still be controlled via ActionScript; it can still be played, stopped, and detected with hitTest( ); and it can still receive other movie clip events. Invisible clips are simply not displayed on screen.

The initial value of the _visible property for all movie clips is true, even for movie clips that are fully transparent or completely off stage. The _visible property changes only when it is deliberately modified by a script; think of it as a way to show and hide clips programmatically, not as a reflection of all factors (such as position and transparency) that can affect a clip's visibility.

Hiding a movie clip using the _visible property is preferred to setting it to fully transparent or moving it off stage, because the Flash Player does not attempt to draw the graphics in movie clips with _visible set to false, thus improving rendering performance.

Example

The following event handlers hide the current clip when the mouse button is pressed and reveal it when the mouse button is released:

this.onMouseDown = function () {
  this._visible = false;
}
   
this.onMouseUp = function () {
  this._visible = true;
}

See Also

MovieClip._alpha


Table of Contents