Create Animation For A Button State; Add An Action To A Button - MACROMEDIA FLASH MX 2004-LEARNING FLASH Manual

Learning flash
Table of Contents

Advertisement

Create animation for a button state

You'll create a movie clip within the Over state of Button 1, and then create a shape tween in the
movie clip. The shape tween creates an effect that changes the color from gray to red.
On the Stage, double-click Button 1 to open it in symbol-editing mode.
1.
In the Button 1 Timeline, hide all layers except the Color layer. In the Color layer, select the
2.
Over keyframe.
Note: You hide layers by clicking the dot under the Eye column next to the layer name so that a red
X appears.
On the Stage, select the black oval shape for Button 1. Press F8 to make the oval a symbol.
3.
In the Convert to Symbol dialog box, name the symbol Button Animation. Select Movie Clip
4.
(not Button) as the behavior, and click OK.
On the Stage, double-click the Button Animation symbol to switch to symbol-editing mode.
5.
Rename Layer 1 Color Change. Select Frame 15, and then press F6 to add a keyframe.
6.
With the playhead still on Frame 15, select the button shape on the Stage, and in the Property
7.
inspector select a bright shade of red from the Fill Color pop-up menu.
In the Timeline, click any frame between Frames 1 and 15. In the Property inspector, select
8.
Shape from the Tween pop-up menu.
Drag the playhead from Frames 1 to 15 to see the color change.

Add an action to a button

When the user clicks the button and the tweened animation plays, you want the playhead to
move to the end of the Button Animation Timeline and then stop. You'll use ActionScript to
control playhead movement in a Timeline.
Add a new layer to the Button Animation Timeline and name it Actions.
1.
On the Actions layer, add a keyframe to Frame 15 by pressing F6.
2.
Open the Actions panel (Window > Development Panels > Actions) and if necessary, enlarge it
3.
to view both the Actions toolbox and the Script pane.
With Frame 15 of the Actions layer selected, go to the Global Functions > Timeline Control
4.
category of the Actions toolbox and double-click
The
action lets you specify that the playhead stop when it reaches Frame 15.
stop
In the Button Animation Timeline, Frame 15 of the Actions layer now displays a small a,
which indicates that an action is attached to that frame.
Click Scene 1, above the Stage, to exit symbol-editing mode and return to the main document.
5.
Click the options menu control in the upper right of the Actions panel, and select Close Panel
6.
to close the panel.
Select Control > Enable Simple Buttons so you can test the animated button.
7.
.
stop
Add an action to a button
73

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-LEARNING FLASH and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents