Presentation is loading. Please wait.

Presentation is loading. Please wait.

7-1 OBJ Copyright 2003, Paradigm Publishing Inc. Using ActionScript and Creating Templates Macromedia Flash Design & Application.

Similar presentations


Presentation on theme: "7-1 OBJ Copyright 2003, Paradigm Publishing Inc. Using ActionScript and Creating Templates Macromedia Flash Design & Application."— Presentation transcript:

1 7-1 OBJ Copyright 2003, Paradigm Publishing Inc. Using ActionScript and Creating Templates Macromedia Flash Design & Application

2 7-2 OBJ Copyright 2003, Paradigm Publishing Inc.  Define the terms object-oriented programming, object, method, action, event, and parameters. Define the terms object-oriented programming, object, method, action, event, and parameters.  List general guidelines for creating ActionScript in movies. List general guidelines for creating ActionScript in movies.  Switch between Normal mode and Expert mode in the Actions panel and describe the difference between the two modes. Switch between Normal mode and Expert mode in the Actions panel and describe the difference between the two modes.  Add actions to keyframes, buttons, and movie clips. Add actions to keyframes, buttons, and movie clips.  Use the goto and stop actions to control movie playback. Use the goto and stop actions to control movie playback.  Add labels and comments to frames. Add labels and comments to frames.  Create a preloader animation. Create a preloader animation.  Perform a conditional test on a movie property. Perform a conditional test on a movie property. Performance Objectives

3 7-3 OBJ Copyright 2003, Paradigm Publishing Inc.  Create buttons to toggle the playback of a stream soundtrack on and off. Create buttons to toggle the playback of a stream soundtrack on and off.  Use the with action to target start and stop actions at a movie clip instance. Use the with action to target start and stop actions at a movie clip instance.  Use the getURL action to open a Web page during a movie. Use the getURL action to open a Web page during a movie.  Use the fscommand action to control a projector window. Use the fscommand action to control a projector window.  Create and use a Flash template. Create and use a Flash template.  Use the Movie Explorer. Use the Movie Explorer.  List Web resources for learning more about Flash. List Web resources for learning more about Flash.  COMMANDS REVIEW COMMANDS REVIEW Performance Objectives

4 7-4 OBJ Copyright 2003, Paradigm Publishing Inc. Understanding ActionScript Concepts and Terms  ActionScript is a scripting language  scripts are a series of commands that provide instruction to the computer  commands are generally carried out in sequence  generally easy to understand  Learning ActionScript involves:  learning the keywords  using proper syntax

5 7-5 OBJ Copyright 2003, Paradigm Publishing Inc. Object-Oriented Programming  ActionScript is an object-oriented scripting language  similar to JavaScript  Classes are defined with a set of properties and methods  defines the object's characteristics and behavior  instances of a class are referred to as objects  Existing code can be reused  more efficient and easier to maintain

6 7-6 OBJ Copyright 2003, Paradigm Publishing Inc. Actions, Events, and Parameters  Actions  statements that instruct Flash on what to do with a target object  listed in the toolbox in the Actions panel  Events  an event can be a mouse movement, a key pressed on the keyboard, or the loading of a movie clip  the event triggers the action  actions applied to a button or movie clip instance execute when an event occurs  Parameters  also called arguments  provide the variable information for the action statement

7 7-7 OBJ Copyright 2003, Paradigm Publishing Inc. General Guidelines for Writing ActionScript  Before starting to write ActionScript code you should have:  a clear definition of the goal of the movie  a flow chart diagramming the movie's actions  a plan as to which objects will require ActionScript statements  Use comments to document what is happening at key points  Focus on one section at a time until it is working correctly  then save as a separate version as a backup  Object and variable names should be descriptive labels  easily identify the element

8 7-8 OBJ Copyright 2003, Paradigm Publishing Inc. The Actions Panel in Normal Mode Window, Actions or F9 Flash assists you with the programming. The proper syntax for each statement is inserted. Step 1 Double-click action in toolbox. Step 2 Add parameters if the action has any. Flash builds the code for you.

9 7-9 OBJ Copyright 2003, Paradigm Publishing Inc. The Actions Panel in Expert Mode The parameters area is replaced with a larger ActionScript area. Step 1 Double-click action in toolbox. Step 2 Key parameters using proper syntax. Flash does not build the statement for you. Use code hints to view available parameters for the current action. Check SyntaxShow Code Hint Code Hint Switching from Expert mode to Normal code causes Flash to check the syntax. show next code hint

10 7-10 OBJ Copyright 2003, Paradigm Publishing Inc. Controlling Movie Playback

11 7-11 OBJ Copyright 2003, Paradigm Publishing Inc. GotoGoto  Moves the playhead to a different frame in the Timeline  Destination parameter can be specified using a frame number or a frame label  using frame labels is preferable since the label stays with the frame when editing  Includes two choices when it reaches the destination  Go to and Play  Go to and Stop

12 7-12 OBJ Copyright 2003, Paradigm Publishing Inc. OnOn  Dimmed unless a button instance is active  Creates the event handler that specifies to which mouse event you want the action to respond  multiple events can be selected

13 7-13 OBJ Copyright 2003, Paradigm Publishing Inc. Play, Stop, and StopAllSounds  Play  uses no parameters  instructs Flash to begin playing the movie at the point in the Timeline at which the action is executed  Stop  uses no parameters  instructs Flash to stop playing the movie  StopAllSounds  stops all sounds that are currently playing  stream sounds will resume playing when the playhead reaches the frame in which it has been associated

14 7-14 OBJ Copyright 2003, Paradigm Publishing Inc. Assigning Labels to a Keyframe -to reference the destination by name instead of number -if frames are added, moved, or removed, no change is required to the ActionScript. key a name frame label displays next to a red flag

15 7-15 OBJ Copyright 2003, Paradigm Publishing Inc. Assigning Comments to a Keyframe -helps you to remember what is happening in segments of the Timeline -editing is made easier precede comment text with two forward slashes usually entered in a separate layer two green slashes display in front of comment text Comments can also be added in ActionScript code.

16 7-16 OBJ Copyright 2003, Paradigm Publishing Inc. Creating a Preloader Animation  A simple animation at the beginning of a movie that loops until the download is completed  Key concepts:  small animation at the beginning that contains simple text such as a Loading message  ActionScript is added at the end to create a loop  ActionScript is added at the first frame that performs a conditional test

17 7-17 OBJ Copyright 2003, Paradigm Publishing Inc. Performing a Conditional Test  Use the if action  Can have two possible outcomes  true  false  A false action is not required since Flash will simply skip the actions in the curly braces and move to the next line of code if the conditional test proves false if (conditional test) { action to be performed if test is true }

18 7-18 OBJ Copyright 2003, Paradigm Publishing Inc. Adding an Else Statement  Use to specify a false action  Add immediately after the if action if (frames loaded = all frames) { gotoAndPlay(main movie); } else { gotoAndPlay(preloader animation); }

19 7-19 OBJ Copyright 2003, Paradigm Publishing Inc. Nesting If Statements  To perform a test that has more than two possible outcomes  Add an else if action after the initial if block if (frames loaded = all frames) { gotoAndPlay(main movie); } else if (frames loaded > 10) { gotoAndPlay(preloader animation B); } else { gotoAndPlay(preloader animation A); }

20 7-20 OBJ Copyright 2003, Paradigm Publishing Inc. Testing for Status of Frames Loaded  Each movie Timeline has a set of properties identified with an underscore character in front of the property name that can be checked or modified  _framesloaded property returns the number of frames that have been downloaded  _totalframes property returns a value representing the total number of frames within a movie

21 7-21 OBJ Copyright 2003, Paradigm Publishing Inc. Testing for Status of Frames Loaded…/2  Properties are identified with an underscore character at the beginning  Two equals symbols (equality operator) tells Flash to check if the value for the property on the left equals the value for the property on the right (_framesloaded == _totalframes)

22 7-22 OBJ Copyright 2003, Paradigm Publishing Inc. Adding Actions for a Preloader Animation cut, paste, and clear frames as necessary insert a new layer use the drawing tools to create the preloader in frame 1 insert a keyframe and delete the drawn preloader

23 7-23 OBJ Copyright 2003, Paradigm Publishing Inc. Adding Actions for a Preloader Animation…/2 This action will create a loop in which frames 1-11 will continually replay. insert a new layer insert a keyframe double-click goto

24 7-24 OBJ Copyright 2003, Paradigm Publishing Inc. Adding Actions for a Preloader Animation…/3 This action will move the playhead to frame 12 when all of the frames have been downloaded. click if in frame 1 of the Actions layer double-click properties to add to text box -key spaces and equals signs double-click goto key frame number

25 7-25 OBJ Copyright 2003, Paradigm Publishing Inc. Adding Actions for a Preloader Animation…/4 This action causes Flash to stop playing the main movie Timeline. click frame 12 in the Actions layer double-click

26 7-26 OBJ Copyright 2003, Paradigm Publishing Inc. Using Buttons to Toggle the Playing of a Soundtrack On and Off  A streamed soundtrack in a movie clip symbol can be the target action for start and stop sound buttons  provides the user with the ability to turn sound on or off during the movie playback  Requires ActionScript using the with statement

27 7-27 OBJ Copyright 2003, Paradigm Publishing Inc. With Statement targets a named instance of a movie clip stop playing the sound upon pressing and releasing the mouse over the button start playing the sound upon pressing and releasing the mouse over the button

28 7-28 OBJ Copyright 2003, Paradigm Publishing Inc. Using the getURL Action to Open a Web Page During a Movie  The URL parameter can be an absolute or relative address for a Web page or document  Window parameters:  _self:opens within the current window replacing the movie from which it originated  _blank: opens in a new browser window  _parent: opens in the browser in the parent of the current frame  _top: opens in the top-level frame of the current browser window

29 7-29 OBJ Copyright 2003, Paradigm Publishing Inc. Using the getURL Action to Open a Web Page During a Movie…/2 -publish the movie as HTML and as a projector file File, Publish Settings or Ctrl + Shift + F12 click

30 7-30 OBJ Copyright 2003, Paradigm Publishing Inc. Using the fscommand to Control the Player Window  Used to control the environment in the window hosting the movie  Commands for standalone player include fullscreen, allowscale, showmenu, trapallkeys, exec, and quit

31 7-31 OBJ Copyright 2003, Paradigm Publishing Inc. Creating a Template -saves time and ensures consistency -include standard elements such as a company logo, colors, and publishing options File, Save As Template key a name choose or add a category key a brief description of the standardized elements preview appears click Save

32 7-32 OBJ Copyright 2003, Paradigm Publishing Inc. Using a Template File, New From Template click category name click template name description is displayed click Create

33 7-33 OBJ Copyright 2003, Paradigm Publishing Inc. Using the Movie Explorer Panel -a tool with which you can locate or view objects in a movie in a hierarchical display Window, Movie Explorer or Alt + F3 Show Text Show Buttons, Movie Clips and Graphics Show Action Scripts Show Video, Sounds and Bitmaps Show Frames and Layers Customize which Items to Show Expand to view ActionScript statements

34 7-34 OBJ Copyright 2003, Paradigm Publishing Inc. Finding Information About Flash on the Web  Go to the Source  Macromedia maintains tech notes and tutorials on the Flash support center that provide articles on Flash features including step-by-step instructions  www.macromedia.com/support/flash www.macromedia.com/support/flash  Flashkit.com Flash Developer Resource Site  a Web site for developers that includes several resources including forums and free downloads to assist with building Flash movies  www.flashkit.com www.flashkit.com  Flash Magazine  a Web site maintained by volunteer Flash developers from around the world with articles and tutorials on using Flash  www.flashmagazine.com www.flashmagazine.com

35 7-35 OBJ Copyright 2003, Paradigm Publishing Inc. Commands Review How do you display the Actions panel? Window, Actions or F9

36 7-36 OBJ Copyright 2003, Paradigm Publishing Inc. Commands Review How do you display the Movie Explorer panel? Window, Movie Explorer or Alt + F3

37 7-37 OBJ Copyright 2003, Paradigm Publishing Inc. Commands Review How do you create a new document based on a template? File, New From Template

38 7-38 OBJ Copyright 2003, Paradigm Publishing Inc. Commands Review How do you display the Publish Settings dialog box? File, Publish Settings or Ctrl + Shift + F12

39 7-39 OBJ Copyright 2003, Paradigm Publishing Inc. Commands Review How do you save a document as a template? File, Save As Template

40 7-40 OBJ Copyright 2003, Paradigm Publishing Inc.


Download ppt "7-1 OBJ Copyright 2003, Paradigm Publishing Inc. Using ActionScript and Creating Templates Macromedia Flash Design & Application."

Similar presentations


Ads by Google