Trace from the browser, using standard trace()

An article by Josh Buhler at actionscript.org that shows you how to install the Flash Debug Player that’s buried in the application folders of Flash. The Debug Player, along with a text file, allows you to view standard traces from a swf in the browser. Now, if you’ve already read his article skip on down to the bottom of this page because I’ve added a step that will make you even happier.

  1. Uninstall your Flash Player
    Find the uninstaller here:
    Adobe Flash Player Uninstallers.
    Even though this is the first step, this is the one that you’re going to question the most, should I really uninstall my Flash Player and install the Debug Player? The answer is an emphatic “yes”. The Flash Debug Player is the exact same player with a very nice extra feature.
  2. Install the Flash Debug Player
    Find the installer here:
    Adobe Flash Debug Players
  3. Verify installation of the Flash Debug Player
    Restart your browser and right-click (ctrl-click) on a swf.
    You should have the “Debugger” option in the context menu, like the example below.
    Debugger
  4. Create a text file named “mm.cfg” and save it here:
    • OSX
      MacHD:Library:Application Support:Macromedia:mm.cfg
    • Windows Vista
      C:\Users\username\mm.cfg
    • Windows XP
      C:\Documents and Settings\username\mm.cfg
    • Windows 2000
      C:\mm.cfg
    • Linux
      home/username/mm.cfg
  5. Add the following properties to mm.cfg
    • ErrorReportingEnable=0
    • TraceOutputFileEnable=1
    • MaxWarnings=0

    FLASH DEBUG PLAYERS 9,0,28,0 AND NEWER

    The property TraceOutputFileName is no longer needed in mm.cfg. The default location of flashlog.txt has changed and cannot be modified from the following locations:

    • OSX
      MacHD:Users:username:Library:Preferences:Macromedia:Flash Player:Logs:flashlog.txt
    • Windows Vista
      C:\Users\username\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt
    • Windows XP and 2000
      C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
    • Linux
      home/username/.macromedia/Flash_Player/Logs/flashlog.txt

    FLASH DEBUG PLAYERS 9,0,16,0 AND OLDER

    Add the property TraceOutputFileName to mm.cfg

    • OSX
      TraceOutputFileName=MacHD:Users:username :D esktop:flashlog.txt
    • Windows
      TraceOutputFileName=C:\Documents and Settings\username\Desktop\flashlog.txt
  6. Test the Flash Debug Player
    Restart your browser and either publish a swf that uses trace() and view it in the browser, or surf around and find out what other people have been tracing in their movies (that’s one of my favorite options).
    The traces have been output from the browser to flashlog.txt.
    Open up flashlog.txt and see for yourself, you know you want to.

And there you go.

I’m sure many of you are extremely happy right now, and you should be, this is a great tip.
But after a few uses, you’re going to get really annoyed opening and closing the text file to view the new traces … if only there was a way to view the text file being updated in real time like the Output window in Flash. Here’s the new step that will make you rejoice.

NEW STEP

  1. View the text file updating in real time
    • OSX
      • Open Terminal
      • At the prompt type:
        cd <path to flashlog's directory>
        tail -f flashlog.txt
    • Windows
      Go to Windows Server 2003 Tools, and download Windows Server 2003 Resource Kit Tools near the bottom of the page.
      Although it says Windows Server 2003 all over the page, its also made for Windows XP.

      • Install
      • Open Command Prompt
      • At the prompt type:
        cd <path to flashlog's directory>
        tail -f flashlog.txt

Browse to a swf online that uses trace() and watch the magic. Terminal and Command Prompt display the contents of flashlog.txt as it changes … its just like having Flash’s Output window, except this one works in the browser!!

Isn’t this great? Like I said earlier, I’ve gotten this to work on both the mac and the pc and can’t live without it now.
If you have any questions about these steps, feel free to email me or comment below and I’ll be glad to help.

OPTIONAL STEP

  1. Create a shortcut to quickly load up flashlog
    • OSX
      • Create aliases
        • Open Terminal
        • At the prompt type:
          cd ~
          ls -a
        • Make sure there is a file named “.bash_profile”
        • If there isn’t, create one by typing the following at the prompt:
          touch .bash_profile
        • Open .bash_profile to edit it
        • Add the following content to .bash_profile:
          alias trace='open -a /Volumes/MacHD/Applications/Utilities/Console.app/ /Users/username/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt'

          alias cleartrace='cat /dev/null > /Users/username/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt'

        • Save .bash_profile
        • Restart Terminal
        • To open up Console displaying the active flashlog.txt file, type the following at the prompt:
          trace
        • To clear flashlog.txt, at the prompt type:
          cleartrace
    • Windows
      1. Create a batch file
        • Create a text file and rename it flashlog.bat
        • Right-click on the batch file and select “Edit”
        • Add the following content to flashlog.bat:
          cd <path to flashlog's directory>
          tail -f flashlog.txt
        • Double-click on the batch file to see it working.
      2. Create a shortcut to the batch file to set the Command Prompt colors and options
        • Right-click on the batch file and select “Create Shortcut”
        • Right-click on the shortcut and select “Properties”
        • To view the Command Prompt maximized change the pulldown under “Run:”
        • To change the colors of the Command Prompt select the “Colors” tab
        • Unfortunately the “Font” tab options are very limited
        • Under the “Options” tab, select “QuickEdit mode” to be able to easily select and copy and paste
        • Tip for copying and pasting in the Command Prompt:
        • Select the text you want to copy and then right-click it, this puts the selected text into the clipboard … now just hit ctrl-v or paste in any other program.
        • Close out of the properties and double-click on the shortcut to see the flashlog with your colors and options.
About these ads

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s