It may be difficult to debug in a multiplayer virtual world development. Usually we can test the script by putting "trace" in the logic for debugging purpose and view the trace log in the Flash IDE. To debug a multiplayer virtual world, we often need two or more instances running in parallel. They will most probably be running in standalone Flash player or the web browser locally. We will discuss how to set up the Flash player to view the Flash trace log without the Flash IDE.
There is a method to read the trace log without using the Flash IDE. It requires the following files:
mm.cfg
fileflashlog.txt
The default Flash player installed in OS is a normal version without the debug feature. We need the debugger version of Flash player to output the trace log outside the Flash IDE. We will download and install the debugger version of Flash player by going to the following URL in the browser: http://www.adobe.com/support/flashplayer/downloads.html.
The link to the debugger version is about one page below the Flash player download web page. Scroll down and find the title "Adobe Flash Player 10 - Debugger Versions (aka debug players or content debuggers)".
For a Windows user, download the "Windows Flash Player 10 ActiveX control content debugger (for IE)" and the "Windows Flash Player 10 Plugin content debugger (for Netscape-compatible browsers)".
For a Mac user, download the "Macintosh Flash Player 10 Plugin content debugger (Intel-based Macs)" if you are using the Intel-based Macintosh.
If you are using the PowerPC-based Mac, unfortunately the latest Flash player 10 updates dropped the support for PowerPC-based Macs, but you can still download the "Macintosh Flash Player 9 Plugin content debugger (PowerPC-based Macs)". All the examples in the book work well on Flash Player 9.
For a Linux user, download the "Flash Player 10 Linux debugger and standalone players".
The mm.cfg
file configures how the Debugger Flash player behaves.
mm.cfg.
ErrorReportingEnable=1 TraceOutputFileEnable=1
These two lines tell the Flash player debugger to output any error and trace into the logfile.
For Windows XP user, save the file into:
C:Documents and Settingsusernamemm.cfg
For Windows Vista and Windows 7 user, save the file into:
C:Usersusernamemm.cfg
For Macintosh user, save the file into:
/Library/Application Support/Macromedia/mm.cfg
For Linux User, save the file into:
/home/username/mm.cfg
We will create a simple Flash file to trace something and read it.
trace("Testing Trace without Flash IDE");
After setting up the Flash player debugger and running the trace command, a file called flashlog.txt
is created.
The default location of the flashlog.txt:
C:Documents and SettingsusernameApplication DataMacromediaFlash PlayerLogsflashlog.txt.
C:UsersusernameAppDataRoamingMacromediaFlash PlayerLogsflashlog.txt.
/Users/username/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt.
/home/username/Macromedia/Flash_Player/Logs/flashlog.txt.
The simple way to read the Flash logfile is to open the flashlog.txt
directly. We should see the "Testing Trace without Flash IDE" in the flashlog.txt
file.
However, it is not convenient to debug because the opened flashlog.txt
file does not reload automatically when the Flash traces a new output. There are different methods to read the Flash logfile in a better way.
Instead of opening the Flash logfile directly, we can drag the file into a web browser. We can then refresh the browser every time there is an update from trace output.
There are some Firefox add-ons that can read the trace file as a sidebar within Firefox.
FlashTracer can display the trace logfile as a sidebar in Firefox.
flashtracer.xpi.
flashlog.txt
file we just opened.flashlog.txt.
After setting up the Flash Tracer add-on, we can now view the Flash trace output directly in browser while debugging our code.
Firebug is a Firefox add-on for web developers to inspect different information from the opened web page. FlashBug is another add-on that adds a Flash Console tab into Firebug to display the Flash trace logfile.
flashlog.txt
is auto-configured and displayed in the panel.FlashBug provides some more bonus features than FlashTracer. It cannot only read the trace log but also inspects the list of stored Shared Object data. Shared Object is some data that is stored locally, similar to cookies. The same Flash document can access it and save/load the stored data locally.
In Linux and Mac, we can read the Flashlog file in terminal by executing the following command:
For Mac OSX:
tail -f "/Users/{username}/Library/Preferences/Macromedia/Flash Player/
Logs/flashlog.txt"
For Linux:
tail -f "/home/{username}/Macromedia/Flash_Player/Logs/flashlog.txt"
The tail
command reads the files until the end of the file.
The -f
parameter lets the tail
command to keep refreshing for new Flash log output.
This is a convenient way to keep reading the latest trace logfile without Firefox.
3.138.124.40