_root Global Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
_root Global Property Flash 5 (same as "/" in Flash 4 movies)

a reference to the main timeline of the movie in the current level read-only
_root

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 can also be used as the starting point from which to access nested clips using dot syntax. For example:

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

The _root property provides access to a movie clip in explicit terms. That is, a reference that starts with _root is valid (and invariant) from anywhere in a movie. However, note that _root is not necessarily synonymous with _leveln (the main timeline of a given document level) or _global (the global variable space). For information on creating global variables, see _global.

When used in a .swf file that is loaded into a movie cilp, the _root property changes meaning. For complete details, see "The _root and _parent properties" in Chapter 2.

See Also

_leveln; _parent; "Accessing Variables on Different Timelines," and "The _root and _parent properties," in Chapter 2; "Referring to Main Movies with _root and _leveln," in Chapter 13



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net