Getting started with ActionScript
The ActionScript® scripting language lets you add complex interactivity, playback control, and data display to your application. You can add ActionScript in the authoring environment by using the Actions panel, Script window, or an external editor.
ActionScript follows its own rules of syntax, reserved keywords, and lets you use variables to store and retrieve information. ActionScript includes a large library of built‑in classes that let you create objects to perform many useful tasks. For more information on ActionScript, see the following Help titles:
Learning ActionScript 3.0 at www.adobe.com/go/learn_flcs5_learnas3_en
Learning ActionScript 2.0 in Adobe Flash at www.adobe.com/go/learn_cs5_learningas2_en
You don’t need to understand every ActionScript element to begin scripting; if you have a clear goal, you can start building scripts with simple actions.
ActionScript and JavaScript are both rooted in the ECMA-262 standard, the international standard for the ECMAScript scripting language. For this reason, developers who are familiar with JavaScript should find ActionScript immediately familiar. For more information about ECMAScript, go to ecma-international.org.
Adobe recommends |
| ||
![]() | Indroduction to ActionScript 3.0Slekx.comDiscover the fundamentals of ActionScript 3.0 by building your own Flash applications. In just nine short lessons, you'll learn how to use AS3 to interact with internet users worldwide. | ||
Which version of ActionScript should you use?
Flash includes more than one version of ActionScript to meet the needs of different kinds of developers and playback hardware. ActionScript 3.0 and 2.0 are not compatible with each other.
ActionScript 3.0 executes extremely fast. This version requires somewhat more familiarity with object-oriented programming concepts than the other ActionScript versions. ActionScript 3.0 is fully compliant with the ECMAScript specification, offers better XML processing, an improved event model, and an improved architecture for working with onscreen elements. FLA files that use ActionScript 3.0 cannot include earlier versions of ActionScript.
ActionScript 2.0 is simpler to learn than ActionScript 3.0. Although Flash Player runs compiled ActionScript 2.0 code slower than compiled ActionScript 3.0 code, ActionScript 2.0 is still useful for many kinds of projects that are not computationally intensive; for example, more design-oriented content. ActionScript 2.0 is also based on the ECMAScript spec, but is not fully compliant.
ActionScript 1.0 is the simplest form of ActionScript, and is still used by some versions of the Flash Lite Player. ActionScript 1.0 and 2.0 can coexist in the same FLA file.
Flash Lite 2.x ActionScript is a subset of ActionScript 2.0 that is supported by Flash Lite 2.x running on mobile phones and devices.
Flash Lite 1.x ActionScript is a subset of ActionScript 1.0 that is supported by Flash Lite 1.x running on mobile phones and devices.
Using the ActionScript documentation
Because there are multiple versions of ActionScript (2.0 and 3.0), and multiple ways of incorporating it into your FLA files, there are several different ways to learn ActionScript.
This chapter describes the graphical user interface for working with ActionScript. This interface includes the Actions panel, Script window, Script Assist mode, Behaviors panel, Output panel, and Compiler Errors panel. These topics apply to all versions of ActionScript.
Other ActionScript documentation from Adobe will help you learn about the individual versions of ActionScript; see Programming ActionScript 3.0, Learning ActionScript 2.0 in Adobe Flash, Developing Flash Lite 1.x Applications or Developing Flash Lite 2.x Applications. For information about the ActionScript vocabulary, see the ActionScript Language Reference for the version you are working with.
Ways of working with ActionScript
Script Assist mode lets you add ActionScript to your FLA file without writing the code yourself. You select actions, and the software presents you with a user-interface for entering the parameters required for each one. You must know a little about what functions to use to accomplish specific tasks, but you don’t have to learn syntax. Many designers and non-programmers use this mode.
Behaviors also let you add code to your file without writing it yourself. Behaviors are prewritten scripts for common tasks. You can add a behavior and then easily configure it in the Behaviors panel. Behaviors are available only for ActionScript 2.0 and earlier.
Writing your own ActionScript gives you the greatest flexibility and control over your document, but it requires you to become familiar with the ActionScript language and conventions.
Components are prebuilt movie clips that help you implement complex functionality. A component can be a simple user interface control, such as a check box, or it can be a complicated control, such as a scroll pane. You can customize a component’s functionality and appearance, and you can download components created by other developers. Most components require you to write some ActionScript code of your own to trigger or control a component. For more information, see Using ActionScript 3.0 Components.
Writing ActionScript
When you write ActionScript code in the authoring environment, you use the Actions panel or Script window. The Actions panel and Script window contain a full-featured code editor that includes code hinting and coloring, code formatting, syntax highlighting, syntax checking, debugging, line numbers, word wrapping, and support for Unicode.
Use the Actions panel to write scripts that are part of your Flash document (that is, scripts that are embedded in the FLA file). The Actions panel provides features such as the Actions toolbox, which gives you quick access to the core ActionScript language elements, and Script Assist mode, in which you are prompted for the elements needed to create scripts.
Use the Script window if you want to write external scripts—that is, scripts or classes that are stored in external files. (You can also use a text editor to create an external AS file.) The Script window includes code-assistance features such as code hinting and coloring, syntax checking, and auto-formatting.
Additional recommended community content
The following additional videos provide detailed demonstrations of using ActionScript 3.0, the Flash Professional workflow, and using components. Some videos show Flash Professional CS3 or CS4, but still apply to Flash Professional CS5 and CS5.5. Some videos may also show Adobe® Flex®, but ActionScript® 3.0 is the same language in both Flash Professional and Flex® and Flash Builder.
Flash in a Flash - Episode 5: Basic interactivity and ActionScript 3.0 (44:50)
Creating a Document class using ActionScript 3.0 (CS3) (2:38)
Creating an effective workflow between design and development (CS3) (3:41)
Double feature on Alchemy (9:08) (Convert C/C++ code to ActionScript 3.0)
An introduction to AlivePDF (7:14) (Create PDFs from ActionScript 3.0)
An introduction to WiiFlash (7:26) (Use the Wii controller with AIR, Flash and Flex)
Lynda.com Training for Developers – ActionScript 3.0 – Ch.3 Create an image gallery (4:51)
Lynda.com Training for Developers – ActionScript 3.0 – Ch.4 Responding to mouse events (4:07)
The following articles and tutorials provide additional detailed information about working with ActionScript:
Introduction to ActionScript 3.0 (Slekx.com)
Tips for learning ActionScript 3 (Adobe.com)
Introduction to event handling in ActionScript 3 (Adobe.com)
ActionScript 3.0 Migration Resources for Flash (Adobe.com)
Migrating to ActionScript 3: Key concepts and changes (Adobe.com)
Top five misperceptions about ActionScript 3 (Adobe.com)
ActionScript 3 migration cookbook (Adobe.com)
ActionScript 3 migration table (Adobe.com)
Flash and ActionScript components learning guide (Adobe.com)
Flash ActionScript 2.0 Learning Guide (Adobe.com)
The Actions panel
Looking for the Language Reference?
To find reference documentation for a specific ActionScript language element, do one of the following:
Open the ActionScript 3.0 Language Reference, and search for the language element.
Open the ActionScript 2.0 Language Reference, and search for the language element.
Type the language element in the Actions panel, select it, then press F1. (You must press F1 immediately, or this topic opens instead.)
Learning ActionScript
This article is about using the functionality of the Actions panel in Flash Professional, not about writing ActionScript code.
To learn about writing ActionScript, use these resources:
Introduction to ActionScript 3.0 (Slekx.com)
Overview of the Actions panel
To create scripts embedded in a FLA file, enter ActionScript directly into the Actions panel (Window > Actions or press F9).

- A.
- Script pane
- B.
- Panel menu
- C.
- Actions toolbox
- D.
- Script navigator
The Actions panel consists of three panes:
- Script pane
- Lets you type ActionScript code, which is associated with
the currently selected frame (or, for ActionScript 2 only, the currently
selected object).
To keep a particular script displayed in the Script pane, pin the script by clicking the Pin button at the bottom of the pane.
- Actions toolbox
- Groups ActionScript elements by category and provides an alphabetical index. To insert an ActionScript element into the Script pane, double-click it or drag it directly into place in your code in the Script pane..
- Script navigator
- Lists the scripts in your Flash document, and lets you move quickly
between them. Click an item in the Script navigator to view the
script in the Script pane.
To pin a script in the Actions panel, double-click it in the Script navigator. Pinned scripts remain in the Script pane even when a different frame or object is selected in the Timeline or on the Stage.
To hide the Actions toolbox and Script navigator,
click the Show/Hide Toolbox button
at
the top of the Actions panel. When the Actions toolbox is hidden,
you can still use the Add (+) button to access its items.Script window overview
The Script window lets you create external script files that you import into your application. These scripts can be ActionScript, Flash Communication, or Flash JavaScript files. The Add (+) menu lists the language elements available for the type of script you create.

If you have more than one external file open, filenames are displayed on tabs across the top of the Script window.
In the Script window, you can use the following features: the Add (+) menu (which is like the Actions toolbox), find and replace, syntax checking, syntax coloring, auto format, code hinting, code commenting, code collapse, debug options (ActionScript files only), and word wrap. The Script window also lets you display line numbers and hidden characters.
The Script window does not include code-assistance features such as the Script navigator, Script Assist mode, and behaviors. These features are useful only in the context of creating a FLA file, not an external script file.
Tools in the Actions panel and Script window
- Add A New Item To The Script

- Displays the language elements that are also in the Actions toolbox. Select an item to add it to the script.
- Find

- Finds and replaces text in your script.
- Insert Target Path

- (Actions panel only) Helps you set an absolute or relative target path for an action in the script.
- Check Syntax

- Checks for syntax errors in the current script. Syntax errors are listed in the Output panel.
- Auto Format

- Formats your script for proper coding syntax and improved readability. Set autoformatting preferences in the Preferences dialog box, which is available from the Edit menu or from the Actions Panel menu.
- Show Code Hint

- If you’ve turned off automatic code hinting, use Show Code Hint to display a code hint for the line of code you’re working on.
- Debug Options

- (Actions panel only) Sets and removes breakpoints so that you can proceed line by line through your script when debugging. You can use debug options only for ActionScript files, not ActionScript Communication or Flash JavaScript files.
- Collapse Between Braces

- Collapses code that appears between the curly braces or parentheses that currently contain the insertion point.
- Collapse Selection

- Collapses the currently selected code block.
- Expand All

- Expands all collapsed code in the current script.
- Apply Block Comment

- Adds comment markers to the beginning and end of the selected code block.
- Apply Line Comment

- Adds a single-line comment marker at the insertion point, or at the beginning of each line of code in a multiline selection.
- Remove Comment

- Removes comment markers from the current line or all lines of the current selection.
- Show/Hide Toolbox

- Displays or hides the Actions Toolbox.
- Script Assist

- (Actions panel only) In Script Assist mode, you are presented with a user-interface for entering the elements needed to create scripts.
- Help

- Displays reference information for the ActionScript element that is selected in the Script pane. For example, if you click an import statement and then click Help, the reference information for import appears in the Help panel.
- Panel menu

- (Actions panel only) Contains the commands and preferences that apply to the Actions panel. For example, you can set line numbers and word wrapping, access ActionScript preferences, and import or export scripts.
Access context-sensitive Help from the Actions panel
- To select an item for reference, do
any of the following:
Select an ActionScript term in the Actions panel toolbox pane (on the left side of the Actions panel).
Select an ActionScript term in the Actions panel in the Script pane.
Place the insertion point before an ActionScript term in the Actions panel in the Script pane.
- To open the Help panel reference page for the selected
item, do one of the following:
Press F1.
Right-click the item and select View Help.
Click Help
above
the Script pane.
Set ActionScript preferences
Whether you edit code in the Actions panel or the Script window, you can set and modify a single set of preferences.
Controlling external video playback with ActionScript
Multilanguage text and ActionScript
Creating accessibility with ActionScript
Best practices - Organizing ActionScript in an application
Debugging ActionScript 1.0 and 2.0
Script Assist mode and behaviors
Pin scripts in the Actions panel
Set the source path for ActionScript 3.0



