Follow me on Twitter!

Dont Trust This Guy why not take my word for it? A blog by Jim Jeffers

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.

2 Responses to This Article.

  1. Donald Bellenger Says:

    Why not use flash’s remote debugging tools? Remote debugging from the flash IDE isn’t as smooth as it could be, but I think with the inclusion of breakpoints and real-time object/property monitoring it’s going to be much more powerful than this approach. I feel like Adobe doesn’t shine enough light on the remote debugger, as many people seem unaware of it. I only recently discovered it, I couldn’t believe how I ever survived without it.

  2. Jim Jeffers Says:

    Thanks Donald - I will definitely have to give the debugger more thought. But this method still works very well for myself. It also allows me to easily diagnose something that has gone haywire on a live production site.

Leave a Reply

Meta Information

This post was filed under code and tagged with: , , , .

This Post as a Feed

The content of this post and it's comments can be subscribed to as an RSS feed.

DontTrustThisGuy.com and all contents copyright 2003-2007 by Jim Jeffers, unless otherwise noted.Written in valid XHTML and a participant of XFN while being powered by WordPress
Contents under Creative Commons License. Visual design, layout and Cascading Style Sheets may not be reused without permission.
Entries (RSS) and Comments (RSS)