Trace from the browser, using standard trace()

UPDATE (2009-01-24):
  1. Added Vista info
  2. Updated the path to flashlog.txt for Linux
  3. Split Step 4 into two steps
  4. Added optional OSX step for creating aliases
UPDATE (2007-02-09):
  1. Added Linux info
  2. Changed mm.cfg file location for Windows 2000
  3. Made corrections to Step 4
UPDATE (2006-11-17):
  1. As of Flash Player version 9,0,28,0, the default location of flashlog.txt has changed and cannot be modified
UPDATE (2006-01-19):
  1. Changed the property order in mm.cfg
    The original order would sometimes change the name of the flashlog on mac.
  2. Changed MaxWarnings from 100 to 0
    This allows an unlimited number of error messages to be written to the flashlog.
  3. Changed which tail software I recommend for Windows
    I have settled on the tail that is included with Windows Server 2003 Resource Kit Tools.
    It’s native to Windows, easier to install than cygwin, and more stable than Tail XP.

Some great 3rd party debug tools have been released in the past few months that expand upon the standard trace() in Flash. I recently wrote about one of them. Unfortunately, I’ve noticed myself not using these tools as often as I would like because its usually easier and quicker to just use trace(). The biggest drawback about trace, however, is that there’s no way to output from the browser … or is there?

The other day I stumbled upon 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. If you haven’t read his article yet, go on what are you waiting for? If, on the other hand, you like step-by-step instructions that get you up and running the fastest, I’ve recapped his process below. I’ve done this on both the mac and pc and can’t live without it now.

  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.
This entry was posted in AIR, Flash. Bookmark the permalink. Trackbacks are closed, but you can post a comment.

57 Comments

  1. Agi
    Posted August 11, 2009 at 9:27 pm | Permalink

    Use flashtracer : https://addons.mozilla.org/en-US/firefox/addon/3469

    I use it at the moment for both as2 / as3 and works with the flash 10 debug player

  2. Posted August 13, 2009 at 10:37 pm | Permalink

    And how, I wonder, is a winXP user supposed to add the properties to mm.cfg?

  3. Posted August 13, 2009 at 10:50 pm | Permalink

    Problem solved using Agi’s solution. I am using WinXP with firefox 3.0.13 and the flash 10 debugger player for Netscape compatible browsers.

  4. Posted August 14, 2009 at 4:44 am | Permalink

    Mike, mm.cfg is just a text file, right click on it and open it with Notepad.

  5. Sarah
    Posted August 20, 2009 at 2:34 pm | Permalink

    Thank you!!!

  6. Andres
    Posted September 29, 2009 at 12:25 pm | Permalink

    Wow! Very nice guide. This is a lifesaver now that FlashTracer don’t work on Firefox 3.5 or obviously for cross-browser testing. Thanks a bunch.

  7. Posted October 13, 2009 at 6:10 pm | Permalink

    Thank you soooo much for outlining this! Works in Firefox 3.5.3 for me combined with the Flash Tracer plugin. I used to make a hovering text field to show traces online, now I don’t have to mess around with that anymore.

    Now for some proper online debugging!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

  • Pages

  • Categories

  • Archives