Using the trace(); method - from a BROWSER!
by Josh on Nov.20, 2004, under ActionScript, Flash
Update: (April 12, 2007) - More up-to-date instructions and corrections as a result of the release of Flash Player 9.0.28 are found on DigitalFlipbook
How many times have you built something in Flash, tested it a million times or more, have it work great, and then fail as soon as you put it online, or outside the Flash IDE? You then go back to your local version, test some more, and begin throwing trace("something here"); and trace("whyIsntThisWorking"); everywhere. It all works great, and then you put it online again, and it doesn't work. Personally, this seems to happen to me quite often on certain projects. I've often wished that there was some way to trace out what's going on in my .swf files online, so I can figure out what's happening.
Well, hallelujah, brothers and sisters, you can now do this, and I will testify unto you that it is almost a miracle. I've been trying to debug a project at work for about a week now, that used to work fine online, and now it doesn't. But using the technique below, I was able to trace out some info from the swf online, and figure out exactly where my problem was. This will also log errors such as undefined functions and variables for you as well, so this is a valuable tool. The cool thing about this is that it logs the info from any swf that you visit online. Just for fun visit a few Flash sites, and then open up the flashLog.txt file we'll create, and you'll see anything that they may have been tracing.
Disclaimer: I did not discover this on my own, so I can't take complete credit for it. I just thought it was an amazing debug tool, so I'm trying to spread the word. One day in my random travels around the web, I came across the following blog - g.wygonik's flash experiments Greg mentions that it's a Windows only tool, but I started playing around, and I've got it working just fine in OSX.
The secret comes from Macromedia Flex and it's debugging abilities. You don't need to have Flex for this to work, but all the documentation I could find from Macromedia is in the Flex help sections.
For this to work, you'll need to have the Flash Debug Player installed. This means that you'll need to uninstall your current Flash Player, and install the debug player instead. You can find an uninstaller here - http://www.macromedia.com/shockwave/download/alternates/. You'll be able to find the Debug Player in your Flash install folder.
- For OSX users, you'll find it in /Applications/Macromedia Flash MX 2004/Players/Debug/Install Flash Player 7 OSX.app.
- Windows users, it'll be in a similar location. Usually in Start > Programs > Macromedia > Flash Player 7 > Debug. There are two versions of the player to install for Windows. IE requires the ActiveX installer (named: Install Flash Player 7 AX.exe) while other browsers (Opera, Mozilla, and so forth-) require the Flash plug-in installer (named: Install Flash Player 7.exe). Refer to the article above for Windows instructions.
Once you have uninstalled the Flash Player, and installed the Debug Player, you'll need to restart your browser, so bookmark this page. You can then verify that you have the Debug Player installed by right-clicking (control-click - just get a real mouse already Mac users) on a swf. You should have the "debug" option in the context menu, like the example below. Once that's working, onto the next step.

Create a textfile called "mm.cfg". Inside the file, there are a few options for you. The most important options for this to work are below:
-
ErrorReportingEnable=1
-
TraceOutputFileEnable=1
-
TraceOutputFileName=MacHD:Users:username:Desktop:flashLog.txt
-
MaxWarnings=50
-
Swapping "MacHD" with your computer name, and "username" with yours. You can put this wherever you want, just make sure you use the colons ":" and not slashes if you're using OSX. Windows users, same thing, put it where you want it, but you'll use "/" of course.
The firstline, ErrorReportingEnable=1 does just that - it enables error reporting. Then, TraceOutputFileEnable=1 enables the output file. You may be getting the idea now. The TraceOutputFileName is the path to where you want this file to be exported. I like to keep mine on my desktop. There are very few things that make it to my desktop, and this file is one of them, it's that cool. The MaxWarnings is the maximum amount of warnings you want reported. This doesn't limit your trace() statements, just the ActionScript warnings about undefined variables or methods. By default, this is set to 100, so you can leave this line out if you like. Or, you can set it to 0, and it there will be no limit placed. You can find more info about the options you have for this file in the Macromedia LiveDocs for Flex
Now, save this file, and place it in the following location:
- OSX users - MacHD/Library/Application Support/Macromedia/mm.cfg
- Windows - C:\Documents and Settings\username - follow the instructions in the link to Greg Wygonik above.
You don't need to create flashLog.txt, it will be created for you.
Now for the fun part. Open Flash, and create a quick movie with the following lines:
-
trace("hello world");
-
trace(bob);
-
_root.callFunction();
-
var something = 5;
-
trace("something: " + someThing);
-
Publish the swf, and open it in your browser. Or, click the button below.
Now go to the location where you told the flashLog.txt file to be written to. Open this up, and you should see something similar to the following output:

Look at all the cool stuff you get - a warning that a function you're calling doesn't exist, variables being traced out, and a notice that you probably typed a variable wrong. Isn't this thing great? If you decide to make changes to your mm.cfg file, you'll need to restart your browser for those changes to take effect.
Before you start debugging a file online using your flashLog.txt file, you'll want to make sure that you open it up and clear it out first. This doesn't always get emptied by Flash, and so you'll have trace info from multiple swf files all together in one file. If you just open it, select everything, delete it, and then resave the file, you can start with a clean slate to begin tracing to. If you have problems setting this up, post a comment below, and I'll try to respond as soon as I can.
January 14th, 2005 on 7:29 PM
Hello,
I followed the instructions in the link to g.wygonik and yours but it didnt create the log file
I’m using Flash 7.0.19.0 Debug Version, my mm.cfg is:
ErrorReportingEnable=1
TraceOutputFileEnable=1
TraceOutputFileName=C:\Documents and Settings\dqduc.COM\flashlog.txt
What is the problem ? On my company my account is dqduc.COM, is “.” make the problem ?
January 15th, 2005 on 8:11 AM
Where did you place your mm.cfg file? Also, did you follow the steps to add the HOMEDRIVE and HOMEPATH variables in your System Properties?
January 16th, 2005 on 5:45 PM
I placed the mm.cfg in C:\Documents and Settings\dqduc.COM\ as the instructions
January 17th, 2005 on 1:11 AM
And I’ve already set HOMEDRIVE=C:\, HOMEPATH=C:\Documents and Settings\dqduc.COM
January 17th, 2005 on 12:42 PM
Did you use the Flash Player Un-Installer to remove the Flash Plugin before you installed the debug version?
Also, try using an account that doesn’t have the “.” in it. Unfortunately, I don’t use Windows, so I may not be able to help you much in setting this up for XP.
January 17th, 2005 on 5:57 PM
I’ve uninstalled flash plugin before I install the debug version.
I’ll have a try with another account.
Thanks
February 10th, 2005 on 8:36 AM
hey thank you for posting this!
i know it will change my life if i can only get it to work. i followed the steps here, but can’t generate the flashlog.txt.
here is a screenshot of what i have set up.
http://www.bitrub.com/trace.jpg
any ideas?
February 10th, 2005 on 10:45 AM
nevermind, duh. i had it in my users library, not the top level library. thanks man!
December 8th, 2005 on 3:56 AM
tks josh for this great tutotial
it worked from the beginning and it saved me a lot of time in debugging a huge flash app.
even greater is to look at the tracefile with log-application. for max os x users just open your flashLog.txt with Applications>Utilities>Console. Very Comfortable cause it reloads new lines itself and you can clear your textview without loosing the trace - there its magic
cheers
January 20th, 2006 on 3:17 PM
OSX Sucks!
October 24th, 2006 on 5:54 AM
Hi Josh! Your Page is realy amazing! Reading two posts and both are excellent! Now, thanx!
On the Page of Adobe is another hint: With OSX, you can enter “tail -f /path/to/the/log/file.txt” in the Terminal and you’ll see a live output of the file! Great!
Thanx again!
February 5th, 2009 on 10:41 AM
I’m trying to figure out why trace statements are being sent to the Mac OS X system.log file (and filling it up). I don’t have a mm.cfg file to my knowledge, and I can’t find it to change/delete it.
This is an app compiled for “release” in Flex Builder 3, and tested in Flash standalone Debug Player 9.
Any suggestions? Please email (bruce at zeusprod.com)