Exploring the Actions Panel

I l @ ve RuBoard

You can attach actions to buttons , movie clips, or frames by using the Actions panel. Actions can do everything from making the movie stop playing to loading data from an external file. The actions are added to the Actions panel as ActionScript. In this exercise, you'll discover what's available in the Actions panel.

You should have zoo20.fla from the last lesson open. If you closed the file, you can open the file from the Lesson05/Starting folder on the CD-ROM. Just make sure to save it to your hard drive before you continue.

  1. Choose Window > Actions.

    graphics/05fig02.gif

    You've just opened the Actions panel.

    On the left side of the Actions panel is the Actions toolbox. The Actions toolbox contains all the pieces of ActionScript you can add to your movie. On the bottom-right side of the Actions panel is the script pane, where the ActionScript is created. Above the script pane is the parameters pane. If you don't see the parameters pane, click the Options menu control and choose Normal Mode from the Options menu. When you're editing in normal mode, the parameters pane prompts you for the parameters (arguments) needed for each action.

    NOTE

    The title of the Actions panel varies depending on what you currently have selected. Each of the titles refers to the same panel, which is opened by choosing Window > Actions or by pressing F2. We'll just use the generic name Actions panel when referring to any of these titles.

  2. If necessary, click Actions in the Actions toolbox to expand the category.

    graphics/05fig03.gif

    The Actions toolbox is divided into categories: Actions, Operators, Functions, Constants, Properties, Objects, Deprecated, Flash UI Components, and Index. Most of these categories are further divided into subcategories . For example, the Actions category is divided into Movie Control, Browser/Network, Movie Clip Control, Variables, Conditions/Loops, Printing, User-Defined Functions, and Miscellaneous Actions.

    You are not restricted to using the actions listed in the Actions toolbox. You can import an external file into the script pane, and in expert mode you can write your own script directly in the script pane. You can also export the ActionScript in the script pane to an external file, and edit the file outside of Flash.

  3. Click the Movie Control category in the Actions toolbox.

    graphics/05fig04.gif

    When you click the Movie Control category, it expands to reveal five actions: goto , on , play , stop , and stopAllSounds . Each of the actions in the Actions toolbox should be grayed, and the Actions panel's title is simply Actions. That's because you don't currently have any frames, movie clips, or buttons selected.

    TIP

    If you select an element that cannot have actions applied to it, for example a group , the script pane will read, "Current selection cannot have actions applied to it."

  4. Move your pointer over each of the actions listed in the Movie Control category of the Actions toolbox.

    graphics/05fig05.gif

    As you move your pointer over each action, a Tooltip should appear. The Tooltip gives a brief explanation of the action's function. For example, the Tooltip for goto is: "Go to the specified frame of the movie." If you click an action, the same information appears in the parameters pane.

    NOTE

    If you click an action and don't see its description in the parameters pane, click the Arrow button in the top-right corner of the parameters pane.

  5. Click the goto action in the Actions toolbox and then click the Reference button.

    graphics/05fig06.gif

    graphics/05fig07.gif

    The Reference button is on the top-right side of the Actions panel. When you click it, the Reference panel opens, revealing a detailed description of the selected action. Take a few moments to explore the Reference panel. You'll see that it is divided into categories identical to those in the Actions panel. Close the panel when you've finished exploring, but remember that you can open it again by simply clicking the Reference button in the Actions panel.

    TIP

    You can also open the Reference panel by pressing Shift+F1.

    Another useful reference when working with ActionScript is the ActionScript Dictionary. If you purchased the boxed version of Flash, you should have received a copy of the dictionary in the package, as part of the documentation. You can view an HTML version by choosing Help > ActionScript Dictionary. You can also use Appendix D in this book if you need a quick reference.

  6. Click the Options button and select View Line Numbers from the drop-down menu.

    graphics/05fig08.gif

    To make it easier to refer to the bits of code you're going to add to the movie over the course of this lesson and several later lessons, select the View Line Numbers option. If you click the Options button and View Line Numbers is already checked, you don't need to select it. When you select the View Line Numbers option, the Actions panel won't change, but when you start adding ActionScript to the script pane, you'll see that Flash displays the line numbers.

  7. Click the Options menu control in the upper-right corner of the Actions panel, and choose Preferences from the drop-down menu.

    graphics/05fig09.gif

    The Preferences option opens the Preferences dialog box, which is the same dialog box that opens when you choose Edit > Preferences. The Preferences dialog box opens with the ActionScript Editor tab selected.

    The Editing Options section of the ActionScript Editor panel has four settings: Automatic Indentation, Code Hints, Tab Size, and Delay. When the Automatic Indentation option is selected, as it is by default, Flash automatically indents the ActionScript in the script pane in expert mode. You can also enter an integer in the Tab Size box to set the number of spaces by which you want the ActionScript to be indented. When Code Hints is selected, Flash displays syntax, method, and event-completion hints in both expert and normal modes. The Delay slider specifies the amount of time Flash will wait before displaying a code hintyou can change this setting by moving the slider.

    The Text section of the panel lets you modify the display of the ActionScript in the script pane. You can change the font and the font height. If you find that the font displayed in the script pane is too small, just open the Preferences panel and change the font height.

    The Syntax Coloring section lets you modify the color of the text in the script pane. If the Syntax Coloring option is selected, you can set colors for the foreground, background, keywords, comments, identifiers, and strings in the script pane, if it is not selected, you can set the colors for only the foreground and background. You can change a color by clicking a color box and choosing a color from the color palette.

    NOTE

    Don't worry if some of the terms found in the ActionScript Editor panel, such as Keywords and Comments, are unfamiliar. You'll learn more about them in Lesson 8.

    Click OK when you've finished exploring the ActionScript Editor panel of the Preferences dialog box. You haven't changed anything in the movie at this point, so it's not necessary to save the file before you continue.

I l @ ve RuBoard


Macromedia Flash MX. Training from the Source
Macromedia Flash MX: Training from the Source
ISBN: 0201794829
EAN: 2147483647
Year: 2002
Pages: 115
Authors: Chrissy Rey

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net