Debugging SWFs within the browser

tail -f flashlog.txtIf your anything like me use you use the trace statement feverishly when developing a flash project, the trace output is the available within the flash IDE and debugging is a straightfoward process. The problem I have found with using trace for debugging is when you move the project into a browser environment. I frequently find that the swf functions slightly different or there are bugs which cause the swf to silently die. There is however a great solution for viewing the trace statements from the browser.

First you’ll need to download and install flash debugger flash player 10 debugger.

Create a file named “mm.cfg” ( if it does not exist) in one of the following locations:

  • Windows; C:Documents and Settingsusernamemm.cfg
  • OSX; /Library/Application Support/Macromedia/mm.cfg
  • Linux; home/username/mm.cfg

Open the newly created mm.cfg file in a text editor and add the following text:
ErrorReportingEnable=1
TraceOutputFileEnable=1

Reboot your machine.

Browser debugging should be now enabled. All trace statements from any swf will be outputted to the file /Users/[username]/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt

Open a flash site, then look at the file and you’ll see all the traces coming from the swf.

Personally I find opening this file each time annoying so I use the tail -f command from the terminal so I can follow the file and see live trace outputs.

tail -f /Users/phil/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt

Check this blog for an explanation the technique customised for windows.