EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 358

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
358 Working with Movie Clips
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 clips parent, and transform the movie
clip and any of the clips 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 an example of scripted animation in Flash, you can find a sample source file,
animation.fla, in the Samples folder on your hard disk.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\Animation.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/Animation.
You can find samples of photo gallery applications on your hard disk.These files provide
examples of how to use ActionScript to control movie clips dynamically while loading image
files into a SWF file, which includes scripted animation. You can find the sample source files,
gallery_tree.fla and gallery_tween.fla, in the Samples folder on your hard disk.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\Galleries.

Table of Contents

Related product manuals