Name

MovieClip._visible Property — whether a clip or movie is shown or hidden

Availability

Flash 4 and later

Synopsis

mc._visible

Access

Read/write

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 hidden clips may still be controlled via ActionScript and still play, stop, receive events, and otherwise operate as normal. Hidden 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 deliberately modified by a script; think of it as a way to programmatically show and hide clips, not 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 button code hides the current clip when the button is depressed and reveals it when the button is released:

on (press) {
  this._visible = false;
}

on (release) {
  this._visible = true;
}

See Also

MovieClip ._alpha

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.