Programming Buttons with Frame Scripts
Chapter 15
430
Figure 15.12 To practice with button actions, create
a movie with identifying text and separate layers
for buttons and actions. Add in-between frames as
needed so that all the layers are the same length.
Figure 15.13 In-between frames extend the Buttons
layer to the match the length of the other layers;
the button symbol in keyframe 1 will be visible
throughout the movie, although the identifying text
from the Frames layer will change.
Programming Buttons
with Frame Scripts
As you learned in the previous chapter, Flashs
button symbols and button components have
certain actions built in. By default, when you
move the mouse into the button area, Flash
jumps to the Over frame; when you click the
button, Flash takes you to the Down frame.
To make the button carry out a task or to
re ne the way a button responds to a user’s
mouse movements, you attach ActionScript
to a keyframe and target an instance of a but-
ton symbol or button component.
To add a button to be controlled by
a frame script:
1.
Using the FrameActionsMaster template
you created earlier in this chapter, open a
new document ( for details on opening new
documents from templates, see Chapter 1).
2.
In the Timeline, add a new layer anywhere
below the Actions layer; name the new
layer Buttons.
Frame 1 of the new layer is a keyframe;
frames 2
5 are in-between frames. Any
items you place on this layer will be
visible throughout the  ve-frame movie
(Figure 15.12).
3.
With the Buttons layer selected, place an
instance of a button symbol on the Stage
(Figure 15.13).
Follow the techniques in Chapter 14 to
create a new button symbol, or use one
from the Common Library of buttons.
(To access this library, choose Window >
Common Libraries > Buttons.) Drag a
button-symbol instance from the library
to the Stage.
Programming Buttons with Frame Scripts
Basic Interactivity
431
Figure 15.14 Select the button symbol on the Stage,
and enter a name in the Instance Name fi eld in the
Property inspector.
4.
To name the button instance, access the
Property inspector and type a name in
the Instance name  eld—for