macromedia flash - actionscript filemacromedia flash - actionscript tutorial home > products >...

Click here to load reader

Post on 11-Aug-2019




1 download

Embed Size (px)


  • Macromedia Flash - ActionScript tutorial

    Home > Products > Flash > Support > Using ActionScript

    ActionScript tutorial

    ActionScript is the scripting language of Macromedia Flash. 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. This two-way communication lets you create interactive movies. In this tutorial, you will examine the tasks involved in creating an interactive puzzle.

    To complete the ActionScript tutorial, you'll take advantage of Flash 5 features beyond what you learned in the lessons and the Using Flash tutorial, and you'll learn more about creating an interactive movie. The tutorial is designed for Flash users who are ActionScript beginners but who want to work towards advanced abilities. You should already be familiar with basic actions and know how to assign them in the Actions panel. To get the most out of this tutorial, you should first complete the tutorial in the Using Flash manual. You should also be comfortable with the concepts presented in the chapter "Creating Interactive Movies" in the Using Flash manual.

    To complete the Using Flash tutorial, in Flash choose Help > Using Flash and select the Tutorial.

    Before you begin, you will need to download either of the following files:

    Download the Windows source file (1.7MB) Download the Macintosh source file actionscript_tutorial.sea.hqx (2.4MB)

    The tutorial takes approximately 1 hour to complete, depending upon your experience, and focuses on the following tasks:

    View the completed movie Initialize the movie Set movie clip properties Save and retrieve information Declare a variable and assign it a value Display information in a dynamic text box Write an expression Control the flow of the movie Write a conditional statement Create commands and reuse code Write a function Call a function Use a built-in object Test the movie The next steps (1 of 2) [11.7.2002 20:42:58]

  • Macromedia Flash - ActionScript tutorial

    Jody Bleyle

    Jody Bleyle writes instructional documentation for Macromedia Flash and has served as the Flash Technical Support team lead.


    10 September 2001


    ActionScript, tutorial, expression, object, actions, variables, properties, code, value, functions



    ©1995-2002 Macromedia, Inc. All rights reserved.

    Use of this website signifies your agreement to the Terms of Use.

    Privacy | Site Map | Contact us | Accessibility | Report Piracy (2 of 2) [11.7.2002 20:42:58]

  • Macromedia Flash - ActionScript tutorial: View the completed movie

    Home > Products > Flash > Support > Using ActionScript

    View the completed movie

    Before you start to work on your own movie, view a completed version of this tutorial to get an idea of what you'll create. Additionally, the completed tutorial lets you examine the Timeline, Movie Explorer, Stage, and Actions panel to understand authoring practices.

    1 In the ActionScript Tutorial folder that you downloaded, open the Finished folder.

    2 Double-click Puzzle.swf to open it in the Flash stand-alone Player.

    3 Click the OK button.

    Notice that the puzzle pieces scramble when you click the OK button.

    4 Click one of the Show/Hide buttons.

    Notice how the different patterns and piece numbers are displayed to guide you in completing the puzzle.

    5 Click a puzzle piece and drag it to the solution area.

    Notice that the piece snaps into place.

    6 Shift-click a puzzle piece.

    Notice that the piece number appears in the circle under the solution area. You can match the piece number to its location in the piece number guide if you get stuck. (1 of 3) [11.7.2002 20:44:58]

  • Macromedia Flash - ActionScript tutorial: View the completed movie

    7 When you finish viewing the SWF file, you can either close the window or leave it open to serve as a reference.

    Analyze the Puzzle.fla file It's helpful to analyze the completed FLA file to determine how the author put it together and where the ActionScript elements are located. To add an ActionScript element to a movie, you must assign it to either a button, a frame, or a movie clip. Frame scripts are indicated by a lowercase a on a frame in the Timeline. To locate button and movie clip scripts (also called object scripts), you select buttons and movie clips on the Stage with the Actions panel open. If you don't know how to assign actions in the Actions panel, see the chapter "Creating Interactive Movies" in the Using Flash manual.

    The Actions panel has two modes, Normal and Expert. This tutorial explains how to add actions in Normal mode. In this tutorial, you will analyze the file by completing the following steps:

    1 In Flash, choose File > Open. Navigate to the downloaded ActionScript Tutorial folder and open thePuzzle.fla file in the Finished folder.

    You now see the completed tutorial movie in the authoring environment.

    2 To see all the contents on the Stage, choose View > Magnification > Show Frame.

    The movie contains only one frame, displayed in the main Timeline of the Puzzle.fla file. This is because you will use ActionScript to show and hide the various dialog boxes and helper guides that appear in the puzzle.

    3 To resize the Timeline and Stage, drag the bar that separates the Stage from the Timeline up and down. Scroll through the Timeline to see how the layers are organized.

    4 To see the dialog boxes and guides on the Stage in the authoring environment, click in the eye column to the right of a layer's name.

    A red X indicates a hidden layer. You click in the Lock column to lock a layer, which prevents it from being selected; this is useful if you are selecting an item on the Stage that is underneath an item on another layer. The square column turns on outlines of all the elements in a layer; this can make it easier to see shape edges and can cause Flash to work faster.

    5 Look at the top layer, which is the Actions layer. (2 of 3) [11.7.2002 20:44:58]

  • Macromedia Flash - ActionScript tutorial: View the completed movie

    You can see in frame 1 that instead of a lowercase a indicating frame actions, this frame contains a keyframe. This is because the Actions layer doesn't contain frame actions, it contains a movie clip with actions assigned to it. You could also have a frame that contained both a keyframe and frame actions.

    Press the Spacebar and grab the Stage with the hand to pull it downward. You can see the actions clip in the top left corner on the Stage.

    6 Select the actions clip by selecting the box on the Stage and choose Window > Actions.

    The Actions panel opens and displays the actions attached to the movie clip.

    7 To locate all of the actions in the movie, choose Window > Movie Explorer or click the Movie Explorer tab.

View more