
Add navigation to return to Scene 1 239
Link a button to a scene
Now that the playhead stops at Frame 1, you’ll add ActionScript that takes
the user to Scene 2 upon releasing the goScene_btn instance.
■
Press Enter (Windows) or Return (Macintosh) twice and type the
following comment. Then write the function that takes users to
Scene 2 upon release of the goScene_btn instance:
// This script takes the user to Scene 2 when goScene_btn
// is released.
goScene_btn.onRelease = function (){
gotoAndStop("Scene 2", 1);
};
In the script that you just typed, you used the
onRelease()
method
for the button object. The
gotoAndStop()
function is a timeline
control function that lets you specify the scene and frame number. In
this case, you specified Frame 1.
Add navigation to return to
Scene 1
The function that you’ll add to the button in Scene 2, to return the user to
Scene 1, is similar to the function that you wrote to take the user to
Scene 2.
1.
In the Scene panel, select Scene 2.
In the Timeline, create a new layer and name it
Actions
.
2.
Select Frame 1 of the Actions layer.
In the Actions panel, enter the following in the Script pane:
// function takes user to Scene 1 when back_btn instance
// is released
back_btn.onRelease = function (){
gotoAndStop("Scene 1", 1);
};
The only differences between this function and the function in Scene 1
are the name of the button and the name of the scene.
3.
In the Scene panel, select Scene 1.
Summary of Contents for FLASH 8-FLASH
Page 1: ...Flash Tutorials...
Page 10: ...10 Contents...
Page 12: ...12 Introduction...
Page 42: ...42 Basic Tasks Creating a banner Part 1...
Page 78: ...78 Basic Tasks Creating a banner Part 3...
Page 88: ...88 Basic Tasks Create Accessible Flash Content...
Page 106: ...106 Basic Tasks Create an Application...
Page 116: ...116 Basic Tasks Use Layout Tools...
Page 124: ...124 Basic Tasks Create Symbols and Instances...
Page 134: ...134 Basic Tasks Add Button Animation and Navigation...
Page 144: ...144 Basic Tasks Create a Presentation with Screens Flash Professional Only...
Page 192: ...192 Creating Graphics Applying Gradients...
Page 198: ...198 Creating Graphics Apply Graphic Filters and Blends Flash Professional Only...
Page 224: ...224 ActionScript Use Script Assist mode...
Page 268: ...268 ActionScript Work with Objects and Classes...
Page 270: ...270 Data Integration Overview Flash Professional Only...