Using The Actions Panel And Script Window - MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Using the Actions panel and Script window

You can embed Flash scripts in your FLA file or store them as external files. It's a good idea to
store as much of your ActionScript code in external files as possible. This makes it easier to reuse
code in multiple FLA files. Then, in your FLA file, create a script that uses
to access the code you've stored externally. Use the .as suffix to identify your scripts as
ActionScript (AS) files. (If you are writing custom class files, you must store them as external
AS files.)
Note: ActionScript code in external files is compiled into a SWF file when you publish, export, test, or
debug a FLA file. Therefore, if you make any changes to an external file, you must save the file and
recompile any FLA files that use it.
When you embed ActionScript code in your FLA file, you can attach code to Frames and to
objects. Try to attach embedded ActionScript to the first frame of the Timeline whenever
possible. That way, you won't have to search through a FLA file to find all your code; it is
centralized in one location. Create a layer called "Actions" and place your code there. That way,
even if you do place code on other Frames or attach it to objects, you'll have to look at only one
layer to find it all.
To create scripts that are part of your document, you enter ActionScript directly into the Actions
panel. To create external scripts, use your preferred text editor or, in Flash Professional, you can
use the Script window. When you use the Actions panel or Script window, you are using the same
ActionScript editor, and are typing your code in the Script pane at the right side of the panel or
window. To reduce the amount of typing you have to do, you can also select or drag actions from
the Actions toolbox to the Script pane.
To display the Actions panel, do one of the following:
Select Window > Development Panels > Actions.
Press F9.
(Flash Professional only) To display the Script window, do one of the following:
To begin writing a new script, select File > New > ActionScript File.
To open an existing script, select File > Open, and then open an existing AS file.
To edit a script that is already open, click the document tab that displays the script's name.
(Document tabs are supported only in Microsoft Windows.)
About the ActionScript editor environment
The ActionScript editor environment consists of two sections. The section on the right is the
Script pane, the area where you type your code. The section on the left is an Actions toolbox that
contains an entry for each ActionScript language element.
58
Chapter 3: Writing and Debugging Scripts
statements
#include

Advertisement

Table of Contents
loading

Table of Contents