Adobe Flash Professional CS6 Adobe Flash Professional CS6 Classroom In A Book | Page 231
adding a Stop action
Now that you have frames on the Timeline, your movie will play linearly from
frame 1 to frame 50. However, with this interactive restaurant guide, you’ll want
your viewers to choose a restaurant to see in whichever order they choose. So you’ll
need to pause the movie at the very first frame to wait for your viewer to click a
button. You use a stop action to pause your Flash movie. A stop action simply stops
the movie from continuing by halting the playhead.
1 Insert a new layer at the top and rename it actions.
2 Select the first keyframe of the actions layer and open the Actions panel
(Window > Actions).
3 In the Script pane, type stop();
The code appears in the Script pane and a tiny lowercase “a” appears in the first
keyframe of the actions layer to indicate it contains some ActionScript. The
movie will now stop at frame 1.
Creating event Handlers for Buttons
Events are occurrences that happen in the Flash environment that Flash can detect
and respond to. For example, a mouse click, a mouse movement, and a key press
on the keyboard are all events. A pinch and a swipe gesture on mobile devices are
also events. These events are produced by the user, but some events can hap-
pen independently of the user, like the successful loading of a piece of data or the
completion of a sound. With ActionScript, you can write code that detects events
and respond to them with an event handler.
222
Lesson 6
Creating Interactive navigation