x You are here: Home > Guides > Flash 4 Tutorials - Overview > Assigning Actions to a Button


If you like this site, please support us by spreading the word.

We have made it easy to let your friends know about us. Just click on the Recommend-It icon below.


 

Flash 4    Tutorials

by Bnuts40

Assigning Actions to a Button


1. Open Flash 4 and create a new Flash Movie Project. See Flash Overview.

2. Create and insert a button into Layer 1, Frame 1 of the movie. See Creating a Button. (This frame must be a Keyframe. Layer 1, Frame 1 is a Keyframe by default).

Note: In this example we will assign an action to the button in Layer 1, Frame 1 to go to a yellow square drawn in Layer 2, Frame 5.

Index

Overview

Creating a Simple Flash Movie

Creating a Tween

Creating Advanced Tweens

Creating a Button

Assigning Actions to a Button

 

Assign an action to the button as follows (see Figures 1 and 2):

3. Select the button in Layer 1 with the "Pick (Arrow) Tool"

4. Select "Modify > Instance" from the menu at top of work area. (The Instance Properties dialog box should appear).

Note: When an object is selected with the Pick Tool and "Modify > Instance" is selected, only the properties of the selected object will be modified. This allows multiple actions to be assigned to different objects within a frame.

Figure 1

Figure 1

5. Select the "Actions Tab" from the Instance Properties dialog box.

6. Select the "Actions Menu (+)" button. (The minus (-) button will remove actions if desired).

7. From the Actions Menu", select "On Mouse Event" then select "Press" (Figure 1).

8. Select the "Actions Menu button again.

9. From the Actions Menu", select "Go To" (Figure 2).

Figure 2

Figure 2


10. Ensure "Scene" is set to "current scene" and type "5" into the "Frame" box.

11. Now select the "Go to and Play" box.

12. Click "OK".

Create the scene that the button will link to as follows (see Figure 3):

Figure 3

Figure 3

13. Insert a new layer into the movie as follows:

14. Right Click the "Layer 1" bar.

15. Select "Insert Layer" from the dialog box. (You should now have Layer 2).

16. Select Layer 2, Frame 5 and insert a Keyframe (F6)

17. Using the Rectangle tool, draw a yellow rectangle in the new Keyframe.

18. Now double click Layer 2, Frame 5. (The Frame Properties dialog box will appear).

19. Select the "Actions Tab", then "Actions Menu". Now select "Stop". (This will stop the movie at Frame 1 until the button is selected).

Congratulations - You have just assigned actions to a button.

Test the button as follows:

  • Select "Control > Test Movie" from the Menu Bar.
  • Click the Button. The yellow square (drawn in Step 17) should appear.

20. Export the movie to an .swf file as desired. See Flash Overview.

 

Back to Top

Copyright © 1999-2002 Romulus 2. All rights reserved. Legal Notice / Privacy Policy.