Name

_root Global Property — a reference to the main timeline of the movie in the current level

Availability

Flash 5 (same as "/" in Flash 4 movies)

Synopsis

_root

Access

Read-only

Description

The _root property stores a reference to the main timeline of the current document level. We use _root to invoke methods on the main movie or to retrieve and set the main movie’s properties. For example:

_root.play( );       // Play the main timeline
_root._alpha = 40;  // Make the whole movie partially transparent

The _root property may also be used to refer to nested clips. For example:

_root.myClip.play( );
_root.shapes.square._visible = false;

The _root property provides access to a movie clip in absolute terms. That is, a reference that starts with _root is valid (and invariant) from anywhere in a movie.

See Also

_level n; _ parent; Section 13.5.4 in Chapter 13 and Section 2.5.6 in Chapter 2

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.