What's an easy way to see the trace()
output of Flash/Flex movies when running in any browser?
9 回答
下载并安装Flash Player 的内容调试器版本。
通过添加 mm.cfg 文件启用跟踪日志记录(官方指南):
ErrorReportingEnable=1
TraceOutputFileEnable=1
mm.cfg 的保存位置取决于操作系统:
- Mac OS X:
/Library/Application Support/Macromedia
- 视窗:
%HOMEDRIVE%\%HOMEPATH%
- Linux:
/home/user name
日志文件 flashlog.txt 位于:
- 视窗 95/98/ME/2000/XP:
C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs
- 视窗:
C:\Users\username\AppData\Roaming\Macromedia\Flash Player\Logs
- Mac OS X:
/Users/username/Library/Preferences/Macromedia/Flash Player/Logs/
- Linux:
/home/username/.macromedia/Flash_Player/Logs/
或者,您可以安装 Firefox 插件FBTracer ,它在Firebug面板中显示跟踪输出。
我只是使用 console.log 功能(最近的浏览器实现了它);
import flash.external.ExternalInterface;
public static function log(msg:String, caller:Object = null):void{
var str:String = "";
if(caller){
str = getQualifiedClassName(caller);
str += ":: ";
}
str += msg;
trace(str);
if(ExternalInterface.available){
ExternalInterface.call("console.log", str);
}
}
查看 De Monster 的 MonsterDebugger。您可以在一个可爱的 AIR 应用程序中调试跟踪对象、轨迹和显示链。使用起来非常有趣。而且它是开源的!
您还可以将 Flash 和 Flex 配置为写入日志文件。在此处查看如何执行此操作:
http://livedocs.adobe.com/flex/3/html/help.html?content=logging_04.html
我最近一直在使用 Monster,但我曾经有一个别名在 flashlog 文件上运行 unix“tail”,这将有效地为我提供一个用于“in browser”跟踪的日志窗口:
alias flashlog='tail -f /PATH/TO/flashlog.txt'
或者,如果您有日志查看器(如 Mac OS 上的控制台),您可以在那里查看日志。我建议这些选项的唯一原因是 FlashTracer 非常“笨拙”;)
如果您想要一个基本的日志文件查看器,Vizzy 会让生活变得更轻松。您只需安装调试播放器,然后安装 Vizzy。它是一个尾随 flashlog 文件的窗口。甜蜜的是,它为您完成了所有 mm.cfg 文件 bs。
可能不像其他人那样花哨或尖端,但我曾经在 Flash 电影中创建自己的日志函数(很有趣,称为 log),它调用 trace 并在页面上调用 js 函数(使用任何你喜欢的方法)。页面上的函数只是一个简单的带有 Firebug 的 console.log()。简单而有效。
我是一个快乐的Thunderbolt用户,也许它也值得一看(多个日志级别,开箱即用的 firebug 玩得很好)。
Unix's tail
command works well for me:
tail -f ~/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt
The -f
switch keeps the log open and tails it via stdout into an open Terminal window. This is a Mac solution, I'm not sure what the Windows tail
equivalent is.
Note that path is based on this document, posted above by @Jarvis.
由于adobe收购了macromedia,我认为它应该是'D:\Documents and Settings\user_name\Application Data\Adobe\Flash Player\Logs\flashlog.txt'。这对我来说损失了几分钟。最后我决定尝试查看 D:\Documents and Settings\user_name\Application Data\Macromedia\Flash Player\Logs\flashlog.txt 和宾果游戏,我可以看到 flash trace() 输出。
我想知道为什么 adobe 仍然将日志文件位置保留在 macromedia 文件夹中。无论是什么,我都可以看到 flash 应用程序的跟踪输出在浏览器中运行,我是一个快乐的人 :)
在 Windows 中,如果您使用操作系统的本地化版本(即西班牙语),“应用程序数据”必须替换为本地化版本(即“Datos de programa”)