ahref.com > Guides > Design
Macromedia Flash Tutorial, Part II, Continued
Adding Actions to Buttons
Now we have a Start button that reacts to the mouse and displays
differently in the Up, Over and Down states. However, it performs no actions.
After creating the Stop and Reset buttons we will add the actions.
Go to
the Instance property of the Start button, which is in the second frame of the
Clock Movie Clip timeline. Do this by selecting the frame, then choosing Modify > Instance.
You will need to add
two actions to the Start button. The first is a Go to Next Frame action, which you can add by selecting the
Go To action and marking the Next checkbox on the right of the dialog window. When that's done, add a
second action inside the On(Release) by highlighting Go to Next
Frame, and selecting (+) and Tell Target.
Now add Timer as
the target by double clicking on it in the Parameters box. Timer will
now appear in the Target box. Again select the plus (+) and add a Play
action. Then add actions to the Stop and Rest buttons. This is what it should look like:
Start Button Actions (in frame 2):
On(Release)
Go to Next Frame
Begin Tell Target Timer
Play
End Tell Target
End On
Stop Button Actions (in frame 3):
On(Release)
Go to Previous Frame
Begin Tell Target Timer
Stop
End Tell Target
End On
Reset Button:
On(Release)
Go to and Play Park
End On
The Reset button illustrates an important concept. Movie Clips must
exist and be available to continue to function. If a Movie Clip is no
longer available, all of its functions are interrupted, and it will
start fresh if it is used again.
In the Clock Movie Clip all the first
frames should consist of Empty Keyframes.
Clicking the Reset button will take the Action back to the first frame,
where the Movie Clips don't exist (so the Timer's display is blank). All of its actions are terminated.
The Reset action is a Go to and
Play, so the Movie Clips will be restarted and the display will show
all zeros and be ready to start again.
|