‘ve been working on some code that has made it difficult to use the normal FlashBuilder based process of running in debug and using the step through debugger. This has me spending a lot of time reading through the flashlog.txt file that the debug player output. I also spend a lot of time seeing the dirty secret trace output that every single SWF on the net seems to belch into the log. On a whim, I wrote a script to switch the logging on or off. If you do much work with scripting or sed, this is pretty basic.
sed -i '' 's/=./='"$1"'/g' /Library/Application\ Support/Macromedia/mm.cfg
Put that in a file (such as ~/bin/setFlashLog), make sure you have execute permission, then just type ‘setFlashLog 1′ or ‘setFlashLog 0′, depending on how you want your logging (on or off).
Not being happy with that, I wrote an even more elaborate script to toggle the setting to the opposite of whatever it’s set at now:
read -r FIRSTLINE < /Library/Application\ Support/Macromedia/mm.cfg
idx=$(($len - 1))
if [ "$value" == "1" ];
sed -i '' 's/=1/=0/g' /Library/Application\ Support/Macromedia/mm.cfg
echo "flash logging: off"
sed -i '' 's/=0/=1/g' /Library/Application\ Support/Macromedia/mm.cfg
echo "flash logging: on"
As with all things *nix, there's probably about 12 other ways to do this. However, since sed was the current favorite hammer, that's what I used to pound the nail. Note that you need the debug player for anything to show up on the log. Also note that the player checks this setting at the time a SWF is loaded, and outputs accordingly. Once the SWF is running, a change in the setting will have no effect.