Control compiler warnings, Output panel overview, Use the trace statement – Adobe Flash Professional CC 2014 v.13.0 User Manual

Page 649

Advertising
background image

To the top

To the top

To the top

Step Out

Advances the Debugger out of a function. This button works only if you are currently stopped in a user-defined function; it moves the

yellow arrow to the line that follows the function call. In the previous example, if you place a breakpoint at line 3 and click Step Out, the Debugger
moves to line 8. Clicking Step Out at a line that is not within a user-defined function is the same as clicking Continue. For example, if you stop at
line 6 and click Step Out, the player continues to execute the script until it encounters a breakpoint.

Step Over

Advances the Debugger over a line of code. This button moves the yellow arrow to the next line in the script. In the previous

example, if you are stopped at line 7 and click Step Over, you advance directly to line 8 without stepping through myFunction(), although the
myFunction() code still executes.

Continue

Leaves the line at which the player is stopped and continues playing until a breakpoint is reached.

End Debug Session

Makes the Debugger inactive but continues to play the SWF file in Flash Player.

Control compiler warnings

You can control the types of compiler warnings that the ActionScript compiler generates in the Compiler Errors panel. When the compiler reports
an error, you can double click on the error to navigate to the line of code that caused the error.

1. Select File > Publish Settings.

2. Click the Flash tab.

3. Click the ActionScript Settings button.

4. Select among the Errors options:

Strict Mode causes warnings to be reported as errors, which means that compilation will not succeed if those errors exist.

Warnings Mode causes extra warnings to be reported that are useful for discovering incompatibilities when updating ActionScript 2.0
code to ActionScript 3.0.

Output panel overview

When you test a SWF file, the Output panel can show information to help you troubleshoot your SWF file. To show this information, add trace()
statements to your code or use the List Objects and List Variables commands.

If you use the trace() statement in your scripts, you can send specific information to the Output panel as the SWF file runs. This could include
notes about the SWF file’s status or the value of an expression. For more information, see the trace() function in the ActionScript 2.0 Language
Reference
at

www.adobe.com/go/learn_cs5_as2lr_en

.

Display or hide the Output panel

Select Window > Output or press F2.

Work with the contents of the Output panel

In the Output Panel menu

, select a command. Here is a partial list:

Copy Copies all the contents of the Output panel to the computer's Clipboard. To copy a selected portion of the output, select the area you want
to copy and then select Copy.

(Deprecated with Flash Professional CC) Save To File Saves the Output panel contents to a text file.

(Deprecated with Flash Professional CC) Filter Level Select None to prevent any information from appearing in the Output panel; select
Verbose to send all information to the Output panel.

Use the trace statement

A trace() statement sends specific information to the Output panel. For example, while testing a SWF file, you can send results to the Output panel
when a button is pressed or a frame plays. The trace() statement is similar to the JavaScript alert statement.

When you use the trace() statement in a script, you can use expressions as parameters. The value of an expression appears in the Output panel
in the test environment.

1. Select a frame in the Timeline and add a trace() statement. For example, you might select Frame 1 and add the following ActionScript 2.0

code:

this.createEmptyMovieClip("img_mc", 10);

var mclListener:Object = new Object();

mclListener.onLoadInit = function(target_mc:MovieClip) {

trace(target_mc+" loaded in "+getTimer()+" ms");

};

mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String, httpStatus:Number) {

trace(">> error downloading image into "+target_mc);

trace(">>\t errorCode="+errorCode+", httpStatus="+httpStatus);

};

var img_mcl:MovieClipLoader = new MovieClipLoader();

642

Advertising