[ Pobierz całość w formacie PDF ]
.Creating Interactive Movies 281To assign an action to a keyframe:1 Select a keyframe in the Timeline and choose Window > Actions.If a selected frame is not a keyframe, the action is assigned to the previouskeyframe.If the selection is not a frame, or if the selection includes multipleframes, the Actions panel will be dimmed.(For information on assigning an action to a button or movie clip, see Assigning actions to objects on page 277.)2 In the Toolbox list on the left side of the panel, click the Basic Actions categoryto display the basic actions.3 To assign an action, do one of the following:" Double-click an action in the Basic Actions category in the Toolbox list." Drag an action from the Toolbox list on the left to the Actions list on the rightside of the panel." Click the Add (+) button, and choose a statement from the pop-up menu." Use the keyboard shortcut.4 To display the Parameters pane, click the triangle in the lower right corner ofthe Actions panel.Select the action and enter new values in the Parameters textboxes to change parameters of existing actions.Parameters vary depending on the action you choose.5 Repeat steps 3 and 4 to assign additional actions as necessary.To test a frame action in a scene:Choose Control > Test Movie.282 Chapter 12Using basic actions for navigationand interactionThe basic actions in the Actions panel let you control navigation and userinteraction in a movie by selecting actions and having Flash write the ActionScriptfor you.The basic actions include the following:" The Go To action jumps to a frame or scene." The Play and Stop actions play and stop movies." The Toggle High Quality action adjusts a movie s display quality." The Stop All Sounds action stops all sounds in the movie." The Get URL action jumps to a different URL." The FSCommand action controls the Flash Player that s playing a movie." The Load Movie and Unload Movie actions load and unloadadditional movies." The Tell Target action controls other movies and movie clips." The If Frame Is Loaded action checks whether a frame is loaded." The On Mouse Event action assigns a mouse event or keyboard key thattriggers an action.In addition, the Print action lets you designate frames of your movie as printable.For information on the other actions available in ActionScript and on advancedinteractivity, see the ActionScript Reference Guide.Creating Interactive Movies 283Jumping to a frame or sceneTo jump to a specific frame or scene in the movie, you use the Go To action.When the movie jumps to a frame, you can play the movie from the new frame(the default) or stop at the frame.The movie can also jump to a scene and play aspecified frame or the first frame of the next or previous scene.To jump to a frame or scene:1 Select the frame, button instance, or movie clip instance to which you willassign the action.2 Choose Window > Actions to display the Actions panel.3 In the Toolbox list, click the Basic Actions category to display the basic actions,and select the Go To action.Flash inserts the Go To and Play action in the Actions list.4 To keep playing the movie after the jump, leave the Go To and Play option (thedefault) selected in the Parameters pane.To stop the movie at a specified frame,deselect Go To and Play.The action changes to Go To and Stop.5 In the Scene pop-up menu in the Parameters pane, specify the destinationscene: Current or Named Scene to specify a frame within the scene, or Next orPrevious to have the movie jump to the first frame of the scene.284 Chapter 126 In the Type pop-up menu in the Parameters pane, choose a destination frame:" Next or Previous Frame." Frame Number, Frame Label, or Expression allow you to specify a frame.Expressions are any part of a statement that produces a value, such as 1+1.7 If you chose Frame Number, Frame Label, or Expression in step 6, for Frame,enter the frame by number, label, or an expression that evaluates to a framenumber or label.The following statement indicates the frame that is five frames ahead of theframe that contains the action:gotoAndStop(_currentframe + 5);For information on writing expressions, see the ActionScript Reference Guide.Creating Interactive Movies 285Playing and stopping moviesUnless instructed otherwise, once a movie starts, it plays through every frame inthe Timeline.You can stop or start a movie at specific intervals by using the Playand Stop actions.For example, you can stop a movie at the end of a scene beforeproceeding to the next scene.Once stopped, a movie must be explicitly startedagain, using the Play action.The Play and Stop actions are most commonly used to control movie clips withbuttons, or to control the main Timeline.The movie clip you want to controlmust have an instance name, must be targeted, and must be present in theTimeline.See Controlling other movies and movie clips on page 295.To start or stop a movie:1 Select the frame, button instance, or movie clip instance to which you willassign the action.2 Choose Window > Actions to display the Actions panel.3 In the Toolbox list, click the Basic Actions category to display the basic actions,and select the Stop action.Flash inserts ActionScript similar to the following in the Actions list:onClipEvent (load) {stop ();}where onClipEvent (load) indicates that when the movie loads, Flash shouldexecute the instruction stop to stop the movie
[ Pobierz całość w formacie PDF ]