![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
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:
trace
statement, which sends programming notes and values of expressions to the Output panel (see Using the trace statement) throw
and try..catch..finally
statements, which let you test and respond to runtime errors from within your scriptYou 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, Control+U opens the Preferences dialog box. If your script assigns Control+U to an action that underlines text onscreen, when you use Test Movie, pressing Control+U will open the Preferences dialog box instead of running the action that underlines text. To let the Control+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.
This opens the Debugger. It also opens the SWF file in test mode.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |