Name

MovieClip._parent Property — a reference to the host clip or movie containing this clip

Availability

Flash 4 and later

Synopsis

mc._parent

Access

Read-only

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 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 may also set the parent timeline’s properties, as in:

_parent._alpha = 50;

The _ parent property may also be used in succession; that is, we may 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 in Chapter 13

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.