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
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:
-
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.
-
Next, go to the terminal and open your ~/.bash_profile
- Then, add the following line somewhere within the file:
-
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.
-
If you don’t have it, create a file in your home directory called ‘mm.cfg’. Add the following:
- 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!