6TJOH#VUUPOTUP$POUSPM(SBQIJD0CKFDUT

$IBQUFS#POVT5BTLT

In the Timeline, in the Actions layer, select
keyframe 1 and access the Actions panel.
 To create a movement variable, in the
Script pane do the following:
S
Place the cursor at the end of line 31
(after the semicolon) and press Enter
to begin a new line.
S
In lines 32–34, type
&&Xe`dXk\k_\Zc`gXZifjjk_\
jZi\\e
&&jg\\[`eg`o\cj
mXidfm\O1EldY\i4('2
e script should match Script 15.38.
A variable is a scripted container that
refers to a piece of information. e value
('
here represents 10 pixels on the Stage.
e variable
dfm\O
stores this value for
later use. In the animation script you will
create in the following steps, the
dfm\O
variable tells Flash how far to reposition
the movie clip named
Xe`dDZ
.

To dene the
dfm\:c`g
event handler,
do the following:
S
With the cursor at the end of line 34
(after the semicolon), press Enter to
begin a new line.
S
In lines 35–38, type
&&\m\ek_Xe[c\i
]leZk`fedfm\:c`g
g<m\ek1<m\ek 1mf`[
r
t
e event handler for
\ek\i=iXd\
looks
very similar to the event handlers for
button events. e dierence is that
the event is now an
<m\ek
rather than a
Dflj\<m\ek
(Script 15.39).
continues on next page
*(kiXejgXi\ek9ke%X[[<m\ekC`jk\e\i
Dflj\<m\ek%:C@:B#_Xe[c\:c`Zb 2
*)&&Xe`dXk\k_\Zc`gXZifjjk_\jZi\\e
**&&jg\\[`eg`o\cj
*+mXidfm\O1EldY\i4('2
4DSJQU%F¾OJOHUIFNPWF9WBSJBCMFBOE
SFHJTUFSJOHGPSUIFFOUFS'SBNFFWFOU
**&&jg\\[`eg`o\cj
*+mXidfm\O1EldY\i4('2
*,&&\m\ek_Xe[c\i
*-]leZk`fedfm\:c`gg<m\ek1<m\ek 1mf`[
*.r
4DSJQU%F¾OJOHUIFNPWF$MJQFWFOUIBOEMFS
&YUSB$SFEJU4DSJQUJOH5BTL
You’ve learned the basics of making but-
tons that stop playback of movie clips in
Flash. Now youre ready to make a button
that starts the movie clip playing again.
With the skills you have learned so far in
this chapter, try this exercise on your own.
Open the TransparentClip.a you cre-
ated in the preceding task. Save the le
as pausePlay.a. Add another button
to the main Timeline, and give it an
instance name. Register for the
Zc`Zb
event of the button using the same
_Xe[c\:c`Zb
event handler. In the event
handler, add a check for the new button,
and trigger
Xe`dDZ
to
gcXp
; when the
new button is clicked.

Get Adobe Flash CS4 Professional for Windows and Macintosh: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.