Programming the Down Button
In this task, you'll program the button that enables users to access the lower half of the Inferno map. You'll use a script much like the ones you learned to create in Lesson 8, Creating Animation and Interactivity. As you program the button this time, keep the preceding discussion in mind.
1. | Open dante.fla from the dante/flash/folder in your local site. |
This file is already partially built, with the graphics in place to enable you to focus on the architectural and scripting aspects of the movie.
2. | Click the red button with the down-pointing arrow in the lower-right corner to select it. |
This button was created for you in advance. Its purpose is to enable the user to access Lower Hell. Currently, it lacks an instance name, and no script has been written to do anything with the button.[View full size image]

3. | Use the Property inspector to give it an instance name of down_btn. |
The instance name exposes the button to ActionScript.[View full size image]

4. | Click Frame 1 of the actions layer, and press F9 to open the Actions panel. |
The panel currently has only a stop() action.[View full size image]

5. | Beneath the existing script, add the following code: // Powers the Down button |
The ActionScript tells Flash that whenever a user clicks the down_btn instance, the timeline should skip to the frame label called "lower." onRelease is an event handler that's built into all button instances. gotoAndStop() is a method that's built into all timelines.[View full size image]

6. | Test the movie by pressing Ctrl+Enter (Windows) or Command+Return (Macintosh). Click the button and make sure that Lower Hell appears. |
Lower Hell has an up-pointing button that returns the user to Upper Hell. This button has already been programmed, so you should be able to go back and forth.