Zachary Berry

Designer & Developer

Trace Flex & Flash content (minus Flex/FlashBuilder junk)

Trace Flex & Flash content (minus Flex/FlashBuilder junk)

I use a tail command alias (from FlashApe) to constantly output the contents of my flashlog file to the terminal which makes reading output very useful. However, if you use FlexBuilder/FlashBuilder at all, you’ll notice it will dump millions of useless comments such as

`-> Begin call to AS: getSelectedItems()<br />
<- End call to AS: getSelectedItems, Result = Text23<br />
==> Begin AS external call: designViewComplete()<br />
<== End AS external call: designViewComplete, Result =`

Just resizing the design view is enough to dump tons of these statements into your trace output, which gets very annoying. While working on a project, a friend of mine had the idea of somehow removing these statements, which got me thinking. The dirty solution I came up with is to grep -v the flashlog before you send it to the tail command using a regex that will match any line starting with one of the four arrow characters (->, <-, ==>, <==). As a consequence, you will also remove any traces that begin with these characters, so be mindful of how you write your trace statements. I’m sure there’s a way to modify this to search for ‘Begin call to AS’ and so on.

Anyway, the command is a bash alias called trace. How-to:

  1. First, you’ll need the Flash debug player if you don’t already have it. Go to playerversion.com - if you don’t see (Debug Player) by the version number, go here, and download the appropriate debug players for your browser/OS.

  2. Next, go to the terminal and open your ~/.bash_profile

nano ~/.bash_profile
  1. Then, add the following line somewhere within the file:
alias trace='tail -f /Users/YOUR-USER/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt | grep -v "^\->\|^<\-\|^\=\=>\|^<\=\="'
  1. Be sure to replace YOUR-USER with your username, or, if your flashlog.txt file is in a different location (I’m using OS X, linux will be different) change the command to point wherever your flashlog.txt file is located. If you don’t have a flashlog.txt file, you can create one.

  2. If you don’t have it, create a file in your home directory called ‘mm.cfg’. Add the following:

TraceOutPutFileName=/Users/YOUR-USER/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt
ErrorReportingEnable=1
TraceOutputFileEnable=1
MaxWarnings=9999
  1. Make sure TraceOutPutFileName is the same as the directory you put in your .bash_profile.

Now you should be able to type trace in the terminal to see the trace output, minus the pesky FlashBuilder comments! Yay!

comments powered by Disqus