
getProperty() Global Function
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
534
|
ActionScript Language Reference
getProperty() Global Function
retrieve the value of a movie clip property
Flash 4; deprecated in Flash 5
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 ...