Easy Flash Debugging on OSX.

I recently took on some contract development for another AS3 project and because I wasn't particularly happy with the way I debugged my flash work in the past I decided to come up with a better solution. Not many traditional flash coders realize that they can view the output from their trace statements on a live compiled SWF. The way you do that is fairly straightforward.

Creating an Alias Command

Once you install the debug player, any movie you open in your browser will output it's trace commands to a flashlog.txt file. This is normally located in the Library directory for your user. So we're going to make an alias to open it quickly in terminal. If you're not familiar with alias commands think of them as shortcuts in terminal.

Let's get straight to the meat of it. First we have to find our flashlog. By default the flashlog is stored here:
/Users/[your system username]/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt'

If for whatever reason you aren't getting a flashlog you may need to look into taking some simple modifications to your mm.cfg file.' Otherwise you should be ready to make your alias command.

We want to put our alias command in our shell profile so that the shortcut will be available for us automatically when we open up terminal. To do this launch a new terminal window and type:
nano ~/.bash_profile

Nano works like a regular text editor, so simply paste the alias command below any existing statements in the document, be sure to replace your system username with your actual user name:
alias fl='tail -F /Users/[your system username]/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt'

Now that you've done that hit ctrl-o to save the changes you've just made to the file and ctrl-x to exit nano. Now close the terminal window and open a new terminal. Type 'fl' and press enter. You can now see the live output as any instance of the player writes output to the flashlog. If you want to stop viewing output just hit ctrl-c while you're in the terminal window to close the stream.