![MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual Download Page 68](http://html1.mh-extra.com/html/macromedia/flash-mx-2004-actionscript/flash-mx-2004-actionscript_reference-manual_3378897068.webp)
68
Chapter 3: Writing and Debugging Scripts
Debugging your scripts
Flash provides several tools for testing ActionScript in your SWF files. The Debugger, discussed
in the rest of this section, lets you find errors in a SWF file while it’s running in Flash Player. Flash
also provides the following additional debugging tools:
•
The Output panel, which displays error messages and lists of variables and objects (see
“Using
the Output panel” on page 77
)
•
The
trace
statement, which sends programming notes and values of expressions to the
Output panel (see
“Using the trace statement” on page 79
)
•
The
throw
and
try..catch..finally
statements, which let you test and respond to runtime
errors from within your script
•
The availability of comprehensive compiler error messages, which let you diagnose and fix
problems more readily (see
Appendix A, “Error Messages,” on page 783
)
You must be viewing your SWF file in a special version of Flash Player called Flash Debug Player.
When you install the authoring tool, Flash Debug Player is installed automatically. So if you
install Flash and browse a website that has Flash content, or do a Test Movie, then you’re using
Flash Debug Player. You can also run the installer in the <app_dir>\Players\Debug\ directory, or
launch the stand-alone Flash Debug Player from the same directory.
When you use the Test Movie command to test movies that implement keyboard controls
(tabbing, keyboard shortcuts created using
Key.addListener()
, and so on), select Control >
Disable Keyboard Shortcuts. Selecting this option prevents the authoring environment from
“grabbing” keystrokes, and lets them pass through to the player. For example, in the authoring
environment, U opens the Preferences dialog box. If your script assigns U to an
action that underlines text onscreen, when you use Test Movie, pressing U will open the
Preferences dialog box instead of running the action that underlines text. To let the U
command pass through to the player, you must select Control > Disable Keyboard Shortcuts.
Caution:
The Test Movie command fails if any part of the SWF file path has characters that cannot
be represented using the MBCS encoding scheme. For example, Japanese paths on an English
system do not work. All areas of the application that use the external player are subject to
this limitation.
The Debugger shows a hierarchical display list of movie clips currently loaded in Flash Player.
Using the Debugger, you can display and modify variable and property values as the SWF file
plays, and you can use breakpoints to stop the SWF file and step through ActionScript code line
by line.
You can use the Debugger in test mode with local files, or you can use it to test files on a web
server in a remote location. The Debugger lets you set breakpoints in your ActionScript that stop
Flash Player and step through the code as it runs. You can then go back to your scripts and edit
them so that they produce the correct results.
After it’s activated, the Debugger status bar displays the URL or local path of the file, tells
whether the file is running in test mode or from a remote location, and shows a live view of the
movie clip display list. When movie clips are added to or removed from the file, the display list
reflects the changes immediately. You can resize the display list by moving the horizontal splitter.
Summary of Contents for FLASH MX 2004 - ACTIONSCRIPT
Page 1: ...ActionScript Reference Guide...
Page 8: ...8 Contents...
Page 12: ......
Page 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Page 54: ...54 Chapter 2 ActionScript Basics...
Page 80: ...80 Chapter 3 Writing and Debugging Scripts...
Page 82: ......
Page 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Page 112: ......
Page 120: ...120 Chapter 6 Using the Built In Classes...
Page 176: ......
Page 192: ...192 Chapter 10 Working with External Data...
Page 202: ...202 Chapter 11 Working with External Media...
Page 204: ......
Page 782: ...782 Chapter 12 ActionScript Dictionary...
Page 793: ...Other keys 793 221 222 Key Key code...
Page 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Page 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Page 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Page 816: ...816 Index...