Using the Actions panel and Script window
35
When you use behaviors, which are predefined ActionScript functions (see
“About behaviors”
on page 61
), other workflow and code organization issues must be considered.
About writing scripts to handle events
Writing code for events can be categorized into two major groups: events that occur on the
timeline (in keyframes) and those that occur on object instances (move clips, buttons, and
components). The interactivity of your SWF file or application can be scattered over the
many elements in your project, and you may be tempted to add scripts directly to these
elements. However, Macromedia recommends that you do not add scripts directly to these
elements (keyframes and objects). Instead, you should respond to events by calling functions
that reside in a central location, as described in
“Organizing ActionScript code”
.
Using the Actions panel and
Script window
To create scripts within a FLA file, you enter ActionScript directly into the Actions panel. To
create external scripts that you include or import into your application, you can use the Script
window (File > New and then select ActionScript File) or your preferred text editor.
When you use the Actions panel or Script window, you are using features of the ActionScript
editor to write, format, and edit your code. Both the Actions panel and Script window have
the Script pane (which is where you type your code) and the Actions toolbox. The Actions
panel offers a few more code-assistance features than the Script window. Flash offers these
features in the Actions panel because they are especially useful in the context of editing
ActionScript within a FLA file.
To display the Actions panel, do one of the following:
■
Select Window > Actions.
■
Press F9.
To display the Script window, do one of the following:
■
To begin writing a new script, select File > New and then select 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 shows the script’s name.
For more information, see the following topics:
■
“About the Actions panel” on page 36
■
“About the Script window” on page 37
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...