Download presentation
Presentation is loading. Please wait.
1
Adding Interactivity to Flash Movies Using Buttons and ActionScript SPACE Lab 09-15-04
2
Outline ActionScript Buttons –Creating buttons –Adding actions to buttons Basic events and actions Demonstration
3
ActionScript ActionScript is the scripting language of Macromedia Flash MX. A scripting language is a way to communicate with a program; you can use it to tell Flash what to do and to ask Flash what is happening as a movie runs. Without ActionScript, a movie plays from Frame 1 to the last frame and either repeats from Frame 1 or stops. Flash uses the ActionScript scripting language to add control and interactivity to a movie. on (release) { gotoAndStop(“Frame12”); } Ex.
4
Creating Buttons 1. Choose Insert -> New Symbol in the menu (Or press Ctrl-F8) and the Symbol Properties Box appears. (Or right-click any graphic object and press Convert to Symbol …) Add a name for your button and make sure the Button option is selected.
5
2. Click OK and the button editor opens looking exactly the same as the standard Flash editor, with one exception: You only have four frames in the timeline indicating four button states. The Four Button States UpThe appearance of the button when the pointer is not over it. OverThe appearance of the button when you place the pointer over it. DownThe appearance of the button when you click on it. HitDefines the area that will respond to a click of the mouse. 3. Insert a keyframe in the frame in the timeline as desired. Draw an image for the button the way you want it to be for each button state.
6
4. Click on the button in the Library window and drag it onto the movie. Then right-click on the Button instance and press Actions. The Actions Window should appear as follows: Adding Actions to a Button List of commands arranged in a tree Add a statement Delete a statement Editor field 5. Double-click chosen action to add behavior to button
7
List of events that trigger the action Basic Events PressThe event when the mouse button is depressed within the button hit area (but not released.) ReleaseHappens at the time when the mouse button is released while the cursor is within the button area Roll OverOccurs any time the cursor goes over the button area Key PressTriggered when the user presses the specified key Events
8
Action Parameters Expanded list of Actions Basic Actions gotoAllows the movie to jump to a particular frame stopStop the playing of the movie getURLLaunches a web browser to a specified website fscommandAllows the launching of external applications Basic Actions
9
Basic Action Parameters gotoAndStop gotoAndPlay -Scene : (default - Current scene) -Type : Frame Label -Frame : “s1” Ex. gotoAndStop(“s1”); getURL-URL : http:\\www.yahoo.com -Window : (default – new window) -Variables: (default – none) Ex. getURL("http:\\\\www.yahoo.com"); fscommand-Command : exec -Parameter : space.exe (needs to be at fscommand folder) Ex. fscommand("exec", "space.exe");
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.