MovieClip._parent Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
MovieClip._parent Property Flash 4

a reference to the host clip or movie containing this clip read-only
mc._parent

Description

The _parent property stores a reference to the clip object upon whose timeline mc resides. Main movies don't support the _parent property because they are at the top level (conveniently referred to as _root). References to _root._parent return undefined. The _parent property gives us the powerful ability to manipulate clips in relation to the current clip.

Bugs

Though it is possible in Flash 5 and Flash 6 to reassign the _parent property to another clip, doing so has little purpose?only the reference is changed, not the physical structure of the clips. This unintentional behavior will likely be changed in the future.

Example

If mc resides on the main timeline of a movie, we can play the main timeline from mc using:

_parent.play();

We can also set the parent timeline's properties, as in:

_parent._alpha = 50;

The _parent property can also be used in succession; that is, we can access the _parent of a _parent, as follows:

_parent._parent.play();  // Play the clip two clips above the current clip

See Also

_root; Section 13.5.3



    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