Yes, "trace" only outputs in preview mode.
the "trace" function needs parameters, for example:
trace("hello world");
if the code is reached, you'll see "hello world" in the output windows of preview mode.
learn more about "trace":
http://www.swfkit.com/trace.html