Flash CS3  |  Go to CS4 Help

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();
    	img_mcl.addListener(mclListener);
    	img_mcl.loadClip("http://www.helpexamples.com/flash/images/404.jpg", img_mc);
  2. Select Control > Test Movie to test the SWF file.

    The Output panel displays the results of the trace() statement. For example, the panel might display the following message:

    Output panel

Comments

Comments are no longer accepted for Flash CS3. Flash CS4 is the current version. To discuss Flash CS3, please use the Adobe forum.