Check syntax and punctuation
You can do a quick check of your ActionScript code without publishing the FLA file.
When you check syntax, the current script is checked. If the current script calls ActionScript classes, those classes are
also checked. Other scripts that might be in the FLA file are not checked.
For ActionScript 2.0 files, Check Syntax runs the code through the compiler, generating syntax and compiler errors.
For ActionScript 3.0 files, Check Syntax generates only syntax errors. To generate compiler errors, such as type
mismatches, improper return values, and variable or method name misspellings, you must use the Control > Test
Movie command.
Check syntax
•
In the Actions panel or Script window, click Check Syntax
•
From the panel menu
•
Click in the Script pane, and then press Control+T (Windows) or Command+T (Macintosh).
Syntax errors are listed in the Compiler Errors panel.
Note: In an external ActionScript class file in the Script window, the global classpath (AS2) or source path (AS3) affects
the syntax check. Even if the global classpath or source path is set correctly, you might generate errors, because the
compiler is not aware that this class is being compiled. For more information about ActionScript 3.0 classes, see
and
classesin Programming ActionScript 3.0. For more information on compiling ActionScript 2.0 classes, see Compiling
and exporting classes in Learning ActionScript 2.0 in Adobe Flash at www.adobe.com/go/learn_fl_cs4_learningAS2_en.
Check for punctuation balance
1
Click between braces {}, brackets [], or parentheses () in your script.
2
In Windows, press Control+' (single quote); on the Macintosh, press Command+' (single quote). The text between
braces, brackets, or parentheses is highlighted, and you can check that opening punctuation has corresponding
closing punctuation.
Import and export scripts
You can import a script into the Actions panel or Script window. You can also export your scripts from the Actions
panel to external ActionScript files. (When you use the Script window, exporting is unnecessary because you can
instead save the AS file.)
If text in your scripts doesn't look as expected when you open or import a file, change the import encoding preference.
Import an external AS file
1
In the Script pane, place the insertion point where you want to locate the first line of the external script.
2
Do one of the following:
•
In the Actions panel, select Import Script from the panel menu, or press Control+Shift+I (Windows) or
Command+Shift+I (Macintosh).
•
In the Script window, select File > Import Script or press Control+Shift+I (Windows) or Command+Shift+I
(Macintosh).
(at the upper-right corner of the Actions panel), select Check Syntax.
Updated 5 March 2009
USING FLASH CS4 PROFESSIONAL
.
344
ActionScript
Objects
Need help?
Do you have a question about the 65018518 - Flash CS4 Professional and is the answer not in the manual?
Questions and answers