120
Syntax and Language Fundamentals
5.
Select Modify > Convert to Symbol, select the Movie Clip option, and then click OK to
create the symbol.
6.
Select the movie clip on the Stage and give it the instance name
myClip
in the
Property inspector.
7.
Insert a new layer and rename the layer
actions
.
8.
Add the following ActionScript to Frame 1 of the actions layer:
myClip._xscale = 50;
This line of code targets the
myClip
instance on the Stage. The ActionScript scales the
instance to half its original width. Because the ActionScript is on the same timeline as the
movie clip symbol, you only need to target the instance using the instance name. If the
instance was on a different timeline or nested within another instance, you would need to
modify the target path accordingly.
Targeting a nested instance
You can also target instances that are nested inside other instances. Perhaps you want to place
a second movie clip instance inside of the myClip instance from the exercise in
“Targeting an
instance” on page 119
. You can also target that nested instance using ActionScript. Before you
proceed with the following exercise, you need to complete the exercise in
“Targeting an
instance” on page 119
, and then follow these steps to target a nested instance.
To target a nested instance:
1.
Open target.fla from the procedure on targeting an instance, and rename it
target2.fla
.
2.
Double-click the myClip instance on the Stage.
3.
Select the Oval tool and draw another oval inside of the myClip instance.
4.
Select the new shape, and then select Modify > Convert to Symbol.
5.
Select the Movie Clip option and click OK.
6.
Select the new instance, and type
myOtherClip
in the Instance Name text box of the
Property inspector.
7.
Click Scene 1 in the edit bar to return to the main Timeline.
8.
Add the following ActionScript to Frame 1 of the actions layer:
myClip.myOtherClip._xscale = 50;
This ActionScript resizes the myOtherClip instance to 50% of its current width. Because
the target.fla file modified the myClip instances
_xscale
property, and the myOtherClip
is a nested symbol, you’ll notice that myOtherClip will be 25 percent of the
original width.
Содержание 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...