FLASH CS3
User Guide
410
Debugging ActionScript 3.0
About the ActionScript 3.0 debugger
Flash includes a separate debugger for ActionScript 3.0 that operates somewhat differently from the ActionScript 2.0
debugger. The ActionScript 3.0 debugger only works with ActionScript 3.0 FLA and AS files. FLA files must have
publish settings set to Flash Player 9. When you initiate an ActionScript 3.0 debugging session, Flash launches the
stand-alone debug version of Flash Player to play the SWF file. The debug Flash player plays the SWF in a separate
window from the Flash authoring application window.
The ActionScript 3.0 debugger converts the Flash workspace to a debug workspace that displays panels that are used
for debugging, including the Actions panel and/or Script window, the Debug console, and the Variables panel. The
Debug console displays the call stack and contains tools for stepping through scripts. The Variables panel displays
the variables in the current scope with their values and allows you to update those values yourself.
Enter debugging mode
The way you begin a debugging session depends on the type of file you are working on. During a debugging session,
Flash interrupts the execution of ActionScript when it encounters a breakpoint or a runtime error.
When Flash initiates a debug session, it adds special information to the SWF file that it exports for the session. This
information allows the debugger to provide the specific line numbers in the code where errors are encountered.
You can include this special debugging information in all SWF files created from a specific FLA file in the Publish
settings. This allows you to debug the SWF file even if you do not explicitly initiate a debug session. This debugging
information makes the SWF file slightly larger.
Start debugging from a FLA file
❖
Select Debug > Debug Movie.
Start debugging from an ActionScript 3.0 AS file
1
With the ActionScript file open in the Script window, select the FLA file that the ActionScript file should be
compiled with from the Target menu at the top of the Script window. The FLA file must also be open in Flash to
appear in this menu.
2
Select Debug > Debug Movie.
Add debugging information to all SWF files created from a FLA file
1
With the FLA file open, select File > Publish Settings.
2
In the Publish Settings dialog box, click the Flash tab.
3
Select Permit Debugging.
Exit debugging mode
❖
Click the End Debug Session button in the Debug Console.
Set and remove breakpoints
Add breakpoints to ActionScript code to interrupt the execution of the code. After execution is interrupted, you can
step through and execute the code line by line, view different sections of your ActionScript, view the values of
variables and expressions, and edit variable values.