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 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 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.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...