Table of Contents

getProperty( ) Global Function Flash 5

retrieve the value of a movie clip propertyFlash 4; deprecated in
getProperty(movieClip, property)

Arguments

movieClip

An expression that yields a string indicating the path to a movie clip. As of Flash 5, this can also be a movie clip reference, because movie clip references are converted to paths when used in a string context.

property

The name of the built-in property to retrieve. Must be an identifier, not a string (e.g., _x, not "_x").

Returns

The value of movieClip's property.

Description

The getProperty( ) function retrieves the value of one of a movie clip's built-in properties. Though getProperty( ) was the only way to access object properties in Flash 4, the dot and [ ] operators are the preferred property-access tools as of Flash 5.

Example

Each of the following getProperty( ) invocations retrieve the values of the _x property of a movie clip, named ball, on the main movie timeline:

getProperty(ball, _x);             // Relative movie clip reference
getProperty(_root.ball, _x);       // Absolute movie clip reference
getProperty("ball", _x);           // Relative path in string
getProperty("_root.ball", _x);     // Dot path in string
getProperty("/ball", _x);          // Slash path in string

The following code shows similar property access using the preferred dot and [ ] operators:

ball._x;
_root.ball._x;
ball["_x"];
_root["ball"]["_x"];
_root["ball"]["_x"];

See Also

setProperty( ); Section 13.1


Table of Contents