Adobe Flash Professional CS6 Adobe Flash Professional CS6 Classroom In A Book | Page 239
7 In your ActionScript code, change all the fixed frame numbers in each of the
gotoAndStop() commands to the corresponding frame labels:
• gotoAndStop(10); should be changed to gotoAndStop("label1");
• gotoAndStop(20); should be changed to gotoAndStop("label2");
• gotoAndStop(30); should be changed to gotoAndStop("label3");
• gotoAndStop(40); should be changed to gotoAndStop("label4");
The ActionScript code now directs the playhead to a particular frame label
instead of a particular frame number.
8 Test your movie by choosing Control > Test Movie > in Flash Professional.
Each button moves the playhead to a different labeled keyframe on the
Timeline, where a different movie clip is displayed. The user can choose to see
any restaurant in any order. However, since the restaurant information covers
the buttons, you can’t return to the original menu screen to choose another
restaurant. You’ll need to provide another button to return to the first frame,
which you’ll do in the next section.
Creating a Home Button with Code Snippets
A home button simply makes the playhead go back to the first frame of the
Timeline, or to a keyframe where an original set of choices, or the main menu, are
presented to the viewer. Creating a button that goes to frame 1 is the same process
as creating the four restaurant buttons. However, in this section, you’ll learn to use
the Code Snippets panel to add ActionScript to your project.
adding another button instance
A home, or main menu, button is provided for you in the Library panel.
1 Select the Buttons layer and unlock it if it is locked.
230
Lesson 6
Creating Interactive navigation