MovieClip._parent

Availability

Flash Player 5.

Usage

my_mc._parent.property
_parent.property 

Description

Property; a reference to the movie clip or object that contains the current movie clip or object. The current object is the object containing the ActionScript code that references _parent. Use the _parent property to specify a relative path to movie clips or objects that are above the current movie clip or object.

You can use _parent to move up multiple levels in the display list as in the following:

this._parent._parent._alpha = 20;

Example

The following example traces the reference to a movie clip and its relationship to the main Timeline. Create a movie clip with the instance name my_mc, and add it to the main Timeline. Add the following ActionScript to your FLA or AS file:

my_mc.onRelease = function() {
   trace("You clicked the movie clip: "+this);
   trace("The parent of "+this._name+" is: "+this._parent);
}

When you click the movie clip, the following information displays in the Output panel.

You clicked the movie clip: _level0.my_mc
The parent of my_mc is: _level0

See also

Button._parent, _root, targetPath(), TextField._parent

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001545.html