set debug mode for flex builder

1. 要具备debug功能,我们必须要首先安装Flash Player Debug 版本。
windows版本
2. 安装好debug版本后,我们还需要添加日志的配置文件mm.cfg。
该配置文件存放的目录如下:
Macintosh OS X MacH D:Library:Application Support:macromedia:mm.cfg
Microsoft Windows XP C:\Documents and Settings\user_name\mm.cfg
Windows 2000 C:\mm.cfg
Linux home/user_name/mm.cfg
以上是从官方文档中找来的,但实际上我用windows2000时,我的mm.cfg文件就是放在C:\Documents and Settings\user_name\mm.cfg下的,和xp一样。
配置文件的配置参数在这里列出:
ErrorReportingEnable        1: 打开error信息写入日志文件 0:关闭
MaxWarnings                      设置waining信息记录最大数量,默认值为100,0:无限制
TraceOutputFileEnable       设置trace日志,1:为开,0:为关,默认值为0
TraceOutputFileName         设置trace日志文件位置,Fleah Player 9 Update版本后该属性设置已经没有用了。笔者也试验过确实没有用。输出文件名为flashlog.txt
mm.cfg例子文件:
ErrorReportingEnable=1
TraceOutputFileEnable=1
3. 输出的日志文件位置:
从Flash Player 9 Update开始,我们不能修改日志文件的位置了,默认的位置为:
Windows C:\Documents and Settings\user_name\Application Data\Macromedia\Flash Player\Logs
Macintosh Users/user_name/Library/Preferences/Macromedia/Flash Player/Logs/
Linux home/user_name/macromedia/Flash_Player/Logs/flashlog.txt
到这里你可以放心的用trace()函数进行数据跟踪了。
4. 这里有个例子:
<?xml version="1.0"?>
<!-- logging/ButtonLifeCycle.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
         private function traceEvent(event:Event):void {
         trace(event.currentTarget + ":" + event.type);
}
]]></mx:Script>
<mx:Button id="b1" label="Click Me"
preinitialize="traceEvent(event)"
initialize="traceEvent(event)"
creationComplete="traceEvent(event)"
updateComplete="traceEvent(event)"
/>
</mx:Application>
运行后如果输出一下内容到flashlog.txt文件的话,那么恭喜你成功了。
TraceLifecycle_3.b1:Button:preinitialize
TraceLifecycle_3.b1:Button:initialize
TraceLifecycle_3.b1:Button:creationComplete
TraceLifecycle_3.b1:Button:updateComplete
TraceLifecycle_3.b1:Button:updateComplete
TraceLifecycle_3.b1:Button:updateComplete
 
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/davidxj/archive/2009/08/07/4417850.aspx
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章