Name
getProperty( ) Global Function — retrieve the value of a movie clip property
Availability
Flash 4; deprecated in Flash 5
Synopsis
getProperty(movieClip, property)
Arguments
- movieClip
An expression that yields a string indicating the path to a movie clip. In Flash 5, this may 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 . and
[] operators are the preferred property-access
tools in Flash 5 and later.
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 stringThe following code shows similar property access using the dot and [ ] operators:
ball._x; _root.ball._x; ball["_x"]; _root["ball"]["_x"];
See Also
setProperty( ) ; Section 13.1 in Chapter 13
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access