Writing Scripts with ActionScript > Using an external text editor

 

Using an external text editor

You can use a text editor to write and edit ActionScript outside the Actions panel. You can export actions from the Actions panel to a text file, import a text file into the Actions panel, or use the include action to add an external script file at runtime.

For more information about using the ActionScript language, see Understanding the ActionScript Language.

 
To export actions as a text file:

1

From the Actions panel pop-up menu (at the upper right of the panel), choose Export as File or press Control+Shift+X (Windows) or Command+Shift+X (Macintosh).

2

Choose a location where the file will be saved, and click Save.

You can then edit the file in an external text editor.

 
To import a text file containing ActionScript:

1

From the Actions panel pop-up menu, choose the Import from File command or press Control+Shift+I (Windows) or Command+Shift+I (Macintosh).

2

Select a text file containing ActionScript, and click Open.

Scripts with syntax errors can be imported only in expert mode. In normal mode, you'll receive an error message.

 
To add an external script to a script within Flash when the movie is exported:

1

Click in the Script pane (at the right of the Actions panel) to place the insertion point where you want the external script to be included.

2

In the Actions toolbox (at the left of the Actions panel), select the Actions category; then select the Miscellaneous Actions category.

3

Double-click the include action to add it to the Script pane.

4

Enter the path to the external file in the Path box.

The path should be relative to the FLA file. For example, suppose your FLA file is myDoc.fla and your external script is called externalfile.as. If myDoc.fla and externalfile.as are in the same folder, the path is externalfile.as. If externalfile.as is in a subfolder called Scripts, the path is scripts/externalfile.as. The text of the external script replaces the include action when the document is exported as a Flash movie (SWF) file.