This is a very handy feature, especially if you have to write your code in Actionscript 2 for which the Flash CS4 debugger is terrible, terrible, terrible. Trace messages are great but when your Flash .swf is running in a browser, and needs to (for instance if it is running on a Facebook application and needs to interact with Facebook real-time) but without using a tool - there are a few - or a custom Flash listener how can you see your trace messages?
Here's how to log them to a file. Note that these instructions are different from what Adobe recommended for Flash CS3/ Flash Player 9. They have changed the rules a bit. Here's how to get this working for Adobe Flash CS4 and the latest Flash Player (version 10.0.12.36 as of this post date.)
Uninstall your current Flash players
Go here and get Adobe's Flash Player uninstaller. Do not try to uninstall your Flash players any other way unless you know exactly what you are doing. You will just screw things up. Close your browsers and run the uninstaller you downloaded.
Download and install the latest Debug Flash Players
Go here to get them. Close all of your browser windows first, then install the plugin version (for FF and plugin-based browsers) and the the ActiveX version for IE. This assumes you are running Windows. Follow instructions in previous link if you are running OSX or Linux.
Create the mm.cfg file
Again, this assumes you are running Windows. Open Explorer and go to the C:\Documents and Settings\[your username] directory. If you don't have this directory check what your HOMEPATH environment variable is set to and browse to that directory instead. Create a text file in this directory named mm.cfg. Paste the following 2 lines of text into the file:
ErrorReportingEnable=1 TraceOutputFileEnable=1
Save the file.
The first line allows the Flash Debug player to write error and warning messages to the file, the second writes trace messages.
Create the flashlog.txt file
Well, let Flash do it for you.
Go to wherever you installed Flash (usually C:\Program Files\Adobe\Flash CS4) and open the Players\Debug directory. Run the FlashPlayer.exe file. That's it.
Run the flashplayer_10_sa_debug.exe file you downloaded above. Again, that's it.
This step is required because the Debug Standalone Player is what initially creates the flashlog.txt file where all of your trace() messages will end up. To verify that it's been created, look for it (in Windows) in C:\Documents and Settings\[username]\Application Data\Macromedia\Flash Player\Logs or the equivalent if you have some different install scheme.
Load your Flash file in a browser
You should see your trace messages output in all their glory in your flashlog.txt file. Ensure that you don't have trace messages being stripped from your Flash file in your Publish Settings!
Notes and Gotchas
tail /F /N50 [your path to flashlog.txt]
The console window will scroll and fill with your trace messages as they happen. If you use Aptana for web development its TailView feature is really handy for this as well. If you don't want to install cygwin or don't have Aptana installed this post describes how to get the same effect.
I found flashlog.txt to be a lifesaver. If anyone has any questions, just let me know.