Name

targetPath( ) Global Function — the absolute path to a movie or movie clip

Availability

Flash 5

Synopsis

targetPath (movieClip)

Arguments

movieClip

A reference to a movie clip object.

Returns

A string representing the path to movieClip in absolute terms, using dot notation (e.g., "_level0.myMovie").

Description

The targetPath( ) function returns a movie clip’s reference as a string that describes the absolute path to the clip (identical to the return value of MovieClip.valueOf( ) ). The targetPath( ) function is sometimes used to compose placement-sensitive code that operates on a movie clip relative to the timeline upon which the clip resides.

Bugs

Note that the example code given for targetPath( ) in the Flash 5 ActionScript Dictionary does not represent the proper usage of targetPath( ); contrary to what the example implies, it is not a synonym for tellTarget( ).

Example

If square is a movie clip contained by shapes, which resides on the main timeline of level 0, then inside the shapes clip, the statement:

targetPath(square);

would return:

"_level0.shapes.square"

See Also

MovieClip ._target, MovieClip.valueOf( ); Section 13.5.6.6 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.