UPDATE (2009-01-24):
- Added Vista info
- Updated the path to flashlog.txt for Linux
- Split Step 4 into two steps
- Added optional OSX step for creating aliases
UPDATE (2007-02-09):
- Added Linux info
- Changed mm.cfg file location for Windows 2000
- Made corrections to Step 4
UPDATE (2006-11-17):
- 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):
- Changed the property order in mm.cfg
The original order would sometimes change the name of the flashlog on mac.
- Changed MaxWarnings from 100 to 0
This allows an unlimited number of error messages to be written to the flashlog.
- 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.
-
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.
-
Install the Flash Debug Player
Find the installer here:
Adobe Flash Debug Players
-
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.
-
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
-
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
esktop:flashlog.txt
-
Windows
TraceOutputFileName=C:\Documents and Settings\username\Desktop\flashlog.txt
-
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
-
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
-
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
-
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.
-
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.
It’s taken me a while to completely settle with an ActionScript editor… SEPY was my tool of choice for well over a year, but I knew that it had its problems, mainly speed and stability. It has plenty of awesome features, but quickly became way too bloated for just an ActionScript editor. It took too long to open and, what’s worse, it would sometimes take up to 2 seconds for the context sensitive completion to popup… something that should be instantaneous.
The new year then rolled around and Keith Peters mentioned that Sapien was having a sale on their popular PrimalScript editor. I remember them having the same sale the year before and I passed on it, but this time I decided to bite the bullet and *gasp* actually spend money on an editor. At first I was very impressed, the context sensitive completion was instantaneous, it had a nice class explorer, and what impressed me the most (and still does) is the extrememly fast context sensitive help… put your cursor on a keyword and hit F1 and a built in browser will almost instantaneously open up showing the flash (or whatever language you are currently using) help for that keyword. The first thing that annoyed me was that you could compile from PrimalScript to Flash by going into a menu and pressing a button, but you couldn’t make a keyboard shortcut for it… I really just wanted to hit CTRL-ENTER like you do in Flash. What I quickly realized with PrimalScript is that you can make suggestions to Sapien and they are quick to respond, and probably even quick to make changes(although not at all to creating a simple keyboard shortcut for a particular menu item), but since its a commercial product you have to wait for them to make another release of the product until you can use that change.
But luckily enough, right when I started trying out PrimalScript, another ActionScript editor was beginning to get some buzz… FlashDevelop. I downloaded my first version of it on January 12th with the release of version 2 Beta8 and haven’t looked back. What a great app! First of all, its free… you can’t beat that. Second, its opensource, so you can download the source at any point and compile your own version of the app right when they make a change to the app, not needing to wait for an official release. Now these things alone wouldn’t be that great if the app was no good, … but the app is more than just good. The context sensitive completion is instantaneous, the project explorer is fantastic, letting you quickly navigate through the classes in your project, you can press F6 and compile the movie in Flash (or even change that keyboard shortcut to CTRL-ENTER if you so like), press F1 on a keyword and get context sensitive help (although not yet as fast as PrimalScript), and this next one is very nice, press F4 on a class or member of an instance of a class it will open that class (and even scroll to the member you selected) or if you currently have a package selected, the Files panel will browse to that package’s path… very nice addition.
I’ve been using FlashDevelop alone for well over two months at home and at work and can’t look back… it is such a great app, it hasn’t crashed on me once and its still in beta … well until today. Today they have released the first release candidate, getting it ever closer to the official 2.0.0 release.
If all of this isn’t enough, the authors of the software are extremely open to suggestions and will implement those suggestions (if they are good suggestions) in relatively short turnaround, allowing you to build your own copy with the change that you requested as soon as its done. With the new release there’s a new XMLCompletion plugin that allows you to get context sensitive completion for xml and html docs, and if we’re lucky a CSSCompletion plugin might be on its way after my suggestion the other day… keep your fingers crossed, I may not ever have to open that way too bloated Dreamweaver again.
So don’t take my word for it, if you haven’t tried it out yet, get over there now and download the latest version. You won’t regret it.
Download FlashDevelop