setProperty( ) Global Function

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
setProperty( ) Global Function Flash 4

assign a value to a movie clip property
setProperty(movieClip, property, value)

Arguments

movieClip

An expression that yields a string indicating the path to a movie clip. In Flash 5 and later, 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 Flash 4 property to which value will be assigned. Must be an identifier, not a string (e.g., _alpha, not "_alpha").

value

The new data value to be assigned to the specified property of movieClip.

Description

The legacy setProperty( ) function assigns value to one of movieClip's built-in Flash 4 properties. It cannot be used to set the value of custom (i.e., user-defined) properties or properties added to MovieClip in Flash 5 or later. In Flash 4, setProperty( ) was the only means to assign movie clip property values; as of Flash 5, the dot and [ ] operators are the preferred means of setting both built-in and custom movie clip properties.

Example

// Flash 4 syntax: Rotate the main movie by 45 degrees: setProperty("_root", _rotation, 45); // Flash 5 and later syntax: Also rotates the main movie by 45 degrees: _root._rotation = 45;

See Also

getProperty( ); "The `Objectness' of Movie Clips," in Chapter 13; Appendix C



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net