356
USING FLASH CS4 PROFESSIONAL
ActionScript
A list of all the variables currently in the SWF file appears in the Output panel. The following example shows the
variables that would be output from the code listed above in step 2:
Global Variables:
Variable _global.myName = "Buster"
Level #0:
Variable _level0.$version = "WIN 9,0,29,3"
Variable _level0.myCatSays = "meow"
Variable _level0.myNum = 313
Variable _level0.myArray = [object #1, class 'Array'] [0:"one",
1:"two",
2:"three"
]
Set and remove breakpoints
A breakpoint lets you stop an application at a specific line of ActionScript. You can use breakpoints to test possible
trouble spots in your code. For example, if you’ve written a set of
if..else
if
statements and can’t determine which one is executing, you can add a breakpoint before the statements and
examine them one by one (step through them) in the Debugger.
You can set breakpoints in the Actions panel, Script window, or Debugger. Breakpoints set in the Actions panel are
saved with the FLA file. Breakpoints set in the Debugger and Script window are not saved in the FLA file and are valid
only for the current debugging session.
Important:
If you set breakpoints in the Actions panel or Script window and click Auto Format, check your breakpoints.
If the Auto Format command removed empty lines, your ActionScript might be moved to a different line. It’s a good idea
to autoformat your scripts before you set breakpoints.
You can view breakpoints in both the Debugger and the Script window by setting them in either one of those windows.
For this to work, the path to the AS file must be the same in both windows.
Do not set breakpoints on comments or empty lines; these breakpoints are ignored.
Set or remove a breakpoint in the Actions panel or Script window
During a debugging session, do one of the following:
•
Click in the left margin of the Script pane. A red dot indicates a breakpoint.
•
Click Debug Options
button.
•
Right-click (Windows) or Control-click (Macintosh) to display the context menu, and select Set Breakpoint,
Remove Breakpoint, or Remove Breakpoints In This File. (In the Script window, you can also select Remove
Breakpoints In All AS Files.)
•
Press Shift+B (Windows) or Shift+B (Macintosh).
Note:
In some previous versions of Flash, clicking in the left margin of the Script pane selected the line of code; now it
adds or removes a breakpoint. To select a line of code, use Control-click (Windows) or Command-click (Macintosh).
Set and remove breakpoints in the Debugger
•
Click in the left margin of the code pane. A red dot indicates a breakpoint.
•
Click Toggle Breakpoint or Remove All Breakpoints above the code view.
•
Right-click (Windows) or Control-click (Macintosh) to display the context menu, and select Set Breakpoint,
Remove Breakpoint, or Remove All Breakpoints in the File.
Updated 5 March 2009