View comments | RSS feed

trace()

Availability

Flash Player 4.

Usage

trace(expression)

Parameters

expression An expression to evaluate. When a SWF file is opened in the Flash authoring tool (using the Test Movie command), the value of the expression parameter is displayed in the Output panel.

Returns

Nothing.

Description

Statement; evaluates the expression and displays the result in the Output panel in test mode.

Use this statement to record programming notes or to display messages in the Output panel while testing a SWF file. Use the expression parameter to check whether a condition exists, or to display values in the Output panel. The trace() statement is similar to the alert function in JavaScript.

You can use the Omit Trace Actions command in the Publish Settings dialog box to remove trace() actions from the exported SWF file.

Example

The following example uses a trace() statement to display in the Output panel the methods and properties of the dynamically created text field called error_txt:

this.createTextField("error_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
for (var i in error_txt) {
   trace("error_txt."+i+" = "+error_txt[i]);
}
/* output:
   error_txt.styleSheet = undefined
   error_txt.mouseWheelEnabled = true
   error_txt.condenseWhite = false
   ...
   error_txt.maxscroll = 1
   error_txt.scroll = 1
*/

Comments


No screen name said on Feb 15, 2005 at 2:22 AM :
My output window doesn't trace anything (anymore), I cannot find anything to turn trace on or off, even the function Debug->List Variables doesn't work, can somebody help me?
JesterXL said on Mar 1, 2005 at 5:49 AM :
Go to File > Publish Settings > Flash Tab, and then uncheck the box "Omit Trace Actions".
protosp said on Apr 1, 2005 at 1:06 PM :
Having the same problem. My "Omit Trace Actions" isn't checked either. In fact, I've checked it and unchecked it just to be sure.
blagus said on Apr 8, 2005 at 9:32 AM :
I must have the output at the HTML, not from inside Flash.
There's somehow to see the output in the flash object at the browser ?

I've created a getURL("javascript: window.alert('" + myTrace + "');"); but doent work fine.

If I can compile my SWF with the trace actions, couldn't have some display to then ?
No screen name said on Apr 26, 2005 at 12:07 PM :
From a post on the support forums:

>>>
My trace ceased working (no output to the output-panel) and my "omit trace
actions" was NOT checked. After hours of disgust, rebooting, reloading
Flash,
etc etc, I finally stumbled on 2 fixes. And I hope they will help anyone
else
experiencing the same problem. And, btw, it wasn't just that the "trace"
wasn't working, but error-output would not work as well (output panel just
blank each time, even when a script compile-error was reported).

1) In the output panel's upper-right menu drop-down, you will notice a
"Filter
Level" option. In it is "None" & "Verbose". YOU WANT THIS SET TO VERBOSE!
You would intuitively think that "None" sounds like "no filtering", but this
is
Not the case. It's just the opposite. Nothing is output! ....extremely
stupid, I think. Why would I not ever want any reported to the output
panel?
especially error messages?!?!??

2) Buggy, flaky thing here.
Even w/all else set right, Flash sometimes still decides not to output any
of
my "trace"s. However, if I force a script-error to occur & then compile
it....
an error WILL BE sent to the output panel. After this, my traces will again
work. Weird....

I hope this helps someone else. I chased "ghosts" for many hours, until I
realized it was my traces not working.... *sigh*
>>>

--

Jeckyl
No screen name said on Aug 17, 2005 at 2:22 AM :
I have been having the same issue. I started using the fix of forcing an error then it would work, but lately I get the error message and still no trace. Very strange. I checked all my settings and nothing worked. Someone told me they think it is a memory issue, but I have a gig of ddr.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001862.html