03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example<br />

See the example for TextField.onKillFocus.<br />

See also<br />

onKillFocus (TextField.onKillFocus h<strong>and</strong>ler)<br />

_parent (TextField._parent property)<br />

public _parent : MovieClip<br />

A reference to the movie clip or object that contains the current text field or object. The<br />

current object is the one containing the <strong>ActionScript</strong> code that references _parent.<br />

Use _parent to specify a relative path to movie clips or objects that are above the current text<br />

field. You can use _parent to climb up multiple levels in the display list as in the following:<br />

_parent._parent._alpha = 20;<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following <strong>ActionScript</strong> creates two text fields <strong>and</strong> outputs information about the<br />

_parent of each object. The first text field, first_txt, is created on the main Timeline. The<br />

second text field, second_txt, is created inside the movie clip called holder_mc.<br />

this.createTextField("first_txt", this.getNextHighestDepth(), 10, 10, 160,<br />

22);<br />

first_txt.border = true;<br />

trace(first_txt._name+"'s _parent is: "+first_txt._parent);<br />

this.createEmptyMovieClip("holder_mc", this.getNextHighestDepth());<br />

holder_mc.createTextField("second_txt", holder_mc.getNextHighestDepth(),<br />

10, 40, 160, 22);<br />

holder_mc.second_txt.border = true;<br />

trace(holder_mc.second_txt._name+"'s _parent is:<br />

"+holder_mc.second_txt._parent);<br />

The following information is displayed in the Output panel:<br />

first_txt's _parent is: _level0<br />

second_txt's _parent is: _level0.holder_mc<br />

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player<br />

7 or later. If your SWF file includes a version 2 component, use the version 2 components'<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method.<br />

TextField 1217

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!