start page | rating of books | rating of authors | reviews | copyrights

Book HomeActionScript: The Definitive GuideSearch this book

Chapter 16. ActionScript Authoring Environment

Contents:

The Actions Panel
Adding Scripts to Frames
Adding Scripts to Buttons
Adding Scripts to Movie Clips
Where's All the Code?
Productivity
Externalizing ActionScript Code
Packaging Components as Smart Clips
Onward!

This chapter examines the practical details of authoring ActionScript code. We'll cover the following topics:

16.1. The Actions Panel

The Actions panel is Flash's ActionScript-editing environment. Every script in a movie is created in the Actions panel, which is accessed via Window Actions.

The Actions panel is divided into two sections: the Toolbox pane (on the left) and the Script pane (on the right), as shown in Figure 16-1.

Figure 16-1

Figure 16-1. The Actions panel

The Script pane houses code attached to the currently selected frame, button, or movie clip. The Toolbox acts both as a quick reference guide and as a means of adding code to the Script pane. Double-clicking any item in the Toolbox adds that item to the Script pane. Items may also be dragged from the Toolbox into the Script pane.

The Actions panel's title indicates whether our current code lives on a frame ( Frame Actions) or on a button or movie clip (Object Actions). When we select a frame, the Actions panel's title changes automatically to Frame Actions; when we select either a movie clip or a button, the Actions panel's title changes to Object Actions.

The organization of the items in the Toolbox differs somewhat from the categories used to describe the features of ActionScript in this book. Most notably, in the Toolbox, statements are not separated into their own folder, and classes and objects are grouped together under the Objects folder. In this book we distinguish between statements, classes, and objects in keeping with more formal programming terminology.

16.1.1. Editing Modes

The Actions panel has two different modes of operation, Normal Mode and Expert Mode, which govern how we add code to the Script pane.

16.1.1.1. Normal Mode

In Normal Mode, the Toolbox is used to build new statements, and the Script pane is used as a viewer for those statements. To add a new statement to the Script pane in Normal Mode, we double-click the desired Action or drag an Action from the Toolbox to the Script pane. To add a statement of arbitrary code, we select the evaluate Action and enter the statement into the Expression field of the Parameters pane (not shown in the figure) at the bottom of the Actions panel.

After adding a statement to the Script pane, we may customize it via the Parameters pane at the bottom of the Actions panel. The layout and contents of the Parameters pane changes to suit the statement selected in the Script pane. Notice that when the Actions panel is operating in Normal Mode, code may not be typed into the Script pane. In Normal Mode, the Script pane is not a text-editing environment, but rather a read-only list of statements; alterations to statements in the Script pane are performed through the Parameters pane.

Although Flash 5's Normal Mode may look similar to the Actions panel in Flash 4, it should not be misconstrued as a backward-compatibility mode. To the contrary, it is quite possible to create code in either editing mode that wouldn't be Flash 4 compatible (see Appendix C, "Backward Compatibility"). Normal Mode is comforting for new programmers but constricting for most nontrivial programming projects. In this book, therefore, we use only the Expert Mode to author code. However, with the exception of multiline comments (which may be used only in Expert Mode), any code produced in one mode may also be produced in the other.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.