Putting Actions in keyframes causes the Action to execute when that frame is
reached, putting Actions on instance 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.
This page will add some buttons to the Welcome animation you recently made when you first entered this section.
Add Buttons To An Animation
Add Buttons To An Animation
Re-open the Welcome animation so we can let the user stop and
continue the animation while it plays.
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 a rectangle 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 instanceone red(for
Stop) and one green(for Play). You can do all this from
the Properties panel.
You need to attach an Action to each button individually. Select the redbutton and access the Actions panel. From the plus
button select Actions
>Movie Control > Stop to add an Action statement to the Script
Area on the Right. The default event is Release,
meaning the Action will execute when the user clicks then release the button.
Now select the green Button instance and assign the Play
Action, found under Actions
> Movie Control > Play. Test the movie, did it work?
Now that you've had a chance to try this on your own, check the Flash Movie I made (click the glasses icon). Does yours act the same way as mine? If you have the time, you should try to make a couple of more interesting looking buttons than the ones I did for the exercise.