Changing movie clip position and appearance

To change the properties of a movie clip as it plays, write a statement that assigns a value to a property or use the setProperty() function. For example, the following code sets the rotation of instance mc to 45:

my_mc._rotation = 45;

This is equivalent to the following code, which uses the setProperty() function:

setProperty("my_mc", _rotation, 45);

Some properties, called read-only properties, have values that you can read but cannot set. (These properties are specified as read-only in their ActionScript 2.0 Language Reference entries.) The following are read-only properties: _currentframe, _droptarget, _framesloaded, _parent, _target, _totalframes, _url, _xmouse, and _ymouse.

You can write statements to set any property that is not read-only. The following statement sets the _alpha property of the wheel_mc movie clip instance, which is a child of the car_mc instance:

car_mc.wheel_mc._alpha = 50;

In addition, you can write statements that get the value of a movie clip property. For example, the following statement gets the value of the _xmouse property on the current level's timeline and sets the _x property of the my_mc instance to that value:

this.onEnterFrame = function() {
    my_mc._x = _root._xmouse;
};

This is equivalent to the following code, which uses the getProperty() function:

this.onEnterFrame = function() {
    my_mc._x = getProperty(_root, _xmouse);
};

The _x, _y, _rotation, _xscale, _yscale, _height, _width, _alpha, and _visible properties are affected by transformations on the movie clip's parent, and transform the movie clip and any of the clip's children. The _focusrect, _highquality, _quality, and _soundbuftime properties are global; they belong only to the level 0 main timeline. All other properties belong to each movie clip or loaded level.

For a list of movie clip properties, see the property summary for the MovieClip class in the ActionScript 2.0 Language Reference.

For a sample source file, animation.fla, that illustrates scripted animation in Flash, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the ActionScript2.0/Animation folder to access the sample.

For samples of photo gallery applications, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the ActionScript2.0/Galleries folder to access these samples: