Chapter 16. ActionScript Authoring Environment
The Actions Panel
16.1. The Actions Panel
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. 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
184.108.40.206. 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.
220.127.116.11. Expert Mode
In Expert Mode the Script pane functions as a traditional text-editing window. When authoring or changing code in Expert Mode, we type directly into the Script pane. We may, however, still double-click items in the Toolbox to add them to the Script pane. The Parameters pane is not used in Expert Mode; instead, parameters are typed directly into the Script pane.
18.104.22.168. Setting the editing mode
The editing mode of the Actions panel is set on a per-frame and per-object basis. That is, Flash remembers the Actions panel editing mode chosen for every object and frame in a movie. If we select Normal Mode for frame 2 and Expert Mode for frame 3, the Actions panel will automatically switch to Normal Mode when we edit the code on frame 2 and Expert Mode when we edit the code on frame 3.
To select the mode for an individual frame or an object, we choose Expert Mode or Normal Mode from the arrow button in the top-right corner of the Actions panel (see Figure 16-1). To select the default mode for all frames and objects of a movie, we choose Expert Mode or Normal Mode under Edit Preferences General Actions Panel Mode. Note that the default mode setting affects only those frames and objects for which an editing mode has not already been set. Therefore, the default mode should be set at the beginning of movie production. There is no way to globally override the individual mode previously set explicitly for existing frames and objects.
Copyright © 2002 O'Reilly & Associates. All rights reserved.