轉自 http://fykyx521.javaeye.com/blog/638123
本工具特點:
1、簡單又方便,無需像其他debuger工具那樣要在flash中添加多餘的調試代碼,只需簡單的trace()就OK!
2、as2,as3均可調試。
3、不存在跨域、安全沙箱問題。
4、不管你的flash運行在什麼程序上,瀏覽器還是其他應用程序。(除開AIR)都可以獲取trace信息。
Flash player的debuger版本有個功能,可以把flash文件中的trace信息輸出到一個名爲flashlog.txt的文本文件中,而且不管當前運行的flash所在的域如何或者是嵌在其他應用程序中,這些trace信息一律都會被記錄在flashlog.txt中。因此我們可以利用這一特性,調試其他flash調試工具無法調試的flash程序。
首先要確認你的機器裏安裝了Flash player的debuger版本,檢測辦法:訪問這裏,右鍵點擊中間那個flash(文字:Adobe Flash Player is installed.),如果在右鍵菜單中有“debuger”或者“調試器”的選項,則說明你已經安裝了debuger版本。一般的如果你安裝了flash 8或者flash cs3的話,都會自動安裝了debuger版本。
接下來,新建一個mm.cfg文件。地址爲:C:/Documents and Settings/username/mm.cfg,其中username爲你的XP系統用戶名,比如Administrator。打開mm.cfg,輸入:
ErrorReportingEnable=0
TraceOutputFileEnable=1
然後,創建一個flashlog.txt文件。地址爲:C:/Documents and Settings/username/Application Data/Macromedia/Flash Player/Logs/flashlog.txt,其中Logs目錄需要自己創建的。這樣,你機器上的flash文件裏的trace信息就會保存在此文件中。但是,需要注意的是此文件只會保存最後打開的flash文件的trace信息。
注意:如果你的flash player的debug版本比較低(9,0,16,0或更早),請在mm.cfg裏添加一條:
TraceOutputFileName=C:/Documents and Settings/username/Application Data/Macromedia/Flash Player/Logs/flashlog.txt
爲了使用方便,我做了一個監控和讀取flashlog.txt文件內容的小工具: FlashTail。在你調試的時候,只要先把它打開,然後再打開需要調試的flash,FlashTail中就會把你的trace信息都顯示出來。
本文地址:http://www.flashrek.com/article.asp?id=43
Configuring the debugger version of Flash Player
Revised 2/4/2008: Added URL for obtaining debugger version of Flash Player.
You use the settings in the mm.cfg text file to configure the debugger version of Flash Player (available from www.adobe.com/support/flashplayer/downloads.html). You must create this file when you first configure the debugger version of Flash Player. The location of this file depends on your operating system. The following table shows where to create the mm.cfg file for several operating systems.
Revised 4/12/2007: Corrected default location of mm.cfg file on Linux.
Revised 2/4/2008: Added location for Windows 95/98/ME and Windows Vista, corrected location for Windows 2000 and Linux.
Operating system |
Create mm.cfg file in this directory |
---|---|
Macintosh OS X |
MacHD:Library:Application Support:macromedia: |
Microsoft Windows Vista |
C:/Users/user_name/ |
Microsoft Windows 2000/XP |
C:/Documents and Settings/user_name/ |
Microsoft Windows 95/98/ME |
%HOMEDRIVE%/%HOMEPATH%/ |
Linux |
/home/user_name |
The following table lists the properties that you can set in the mm.cfg file:
Property |
Description |
---|---|
ErrorReportingEnable |
Enables the logging of error messages. Set the The default value is 0. |
MaxWarnings |
Sets the number of warnings to log before stopping. The default value of the Set the Set the |
TraceOutputFileEnable |
Enables trace logging. Set The default value is 0. |
TraceOutputFileName |
Note: Beginning with the Flash Player 9 Update, Flash Player ignores the Sets the location of the log file. By default, the debugger version of Flash Player writes error messages to a file named flashlog.txt, located in the same directory in which the mm.cfg file is located. Set TraceOutputFileName=<fully qualified path/filename> |
The following sample mm.cfg file enables error reporting and trace logging:
Subtopics
Log file locationLog file location
The default log file location changed between the initial Flash Player 9 release and the Flash Player 9 Update. In the initial Flash Player 9 release, the default location is the same directory as the mm.cfg file and you can update the log file location and name through the TraceOutputFileName
property.
With the Flash Player 9 Update, you cannot modify the log file location or name. The filename is flashlog.txt, and its location is hard-coded, depending on your operating system. The following table shows the flashlog.txt file location:
Revised 2/4/2008: Corrected default locations for log file.
Operating system |
Location of flashlog.txt |
---|---|
Macintosh OS X |
MacHD:Users:user_name:Library:Preferences:Macromedia:Flash Player:Logs:flashlog.txt |
Microsoft Windows Vista |
C:/Users/user_name/AppData/Roaming/Macromedia/Flash Player/Logs/flashlog.txt |
Windows 95/98/ME/2000/XP |
C:/Documents and Settings/user_name/Application Data/Macromedia/Flash Player/Logs/flashlog.txt |
Linux |
/home/user_name/.macromedia/Flash_Player/Logs/flashlog.txt |