Use the previous animation file: MX04_ActionScripting-Loops.fla so
we can let the user stop and continue the animation while it plays.
Reopen Scene 1 the wine_expert Movie Clip.
Insert a new layer for the buttons. You don't want to place
buttons in the layer with an animation; that will affect the tween. Name this
layer Buttons.
Into the Buttons layer, draw an Oval that will become your
button.
Select
it, and then convert to symbol (F8). Name it MyButton and
make sure the behavior is set to Button.
You'll need two buttons, so either copy and paste the instance
already onstage or drag another instance of the MyButton symbol
from the Library onto the Stage in the Buttons layer.
Apply a Tint color style to each instance—one red (for Stop)
and one green (for Play). You can do all this from the Properties
panel.
Using the Text tool type STOP on the Red button and PLAY on
the Green button. Use Arial Black at 20pt and a Black color.
You need to attach an Action to each button individually. Select the red
button and access the Actions panel [F9]. From the plus button select Global
Functions > Movie Clip Control > on choose release and then,
select Global Functions > Timeline Control > Stop.
Now select the green Play Button instance and assign the Play
Action select, Global Functions > Movie Clip Control > on choose release and
then, select Global Functions > Timeline Control > Play.
What you’ve learned in this lesson:
Putting Actions in keyframes causes the Action to execute
when that frame is reached.
Putting Actions on instances of buttons makes the Action
execute when the user clicks a button.
Keyframe Actions are fairly straightforward: You assign them to the keyframe.
Buttons on the other hand, require that you specify to which mouse event you
want to respond, mouse press, mouse release, etc.
NEW TERM: Mouse Events are specific situations that refer to exactly
how the user is interacting with a button.