问题描述
在 Eclipse 中,我使用以下 Macrodef 启动一个带有从 ANT 嵌入的 swf 的 html 页面:
Inside eclipse I'm launching an html page with a swf embedded from ANT using the following Macrodef:
<macrodef name="runhtml">
<attribute name="url" />
<attribute name="browser" default="${app.browser.firefox}" />
<sequential>
<exec
executable="open"
vmlauncher="true"
spawn="false"
failonerror="true">
<arg line="-a '@{browser}'" />
<arg line="@{url}" />
</exec>
</sequential>
</macrodef>
尽管 swf 包含跟踪,但我在控制台中没有从它们获得任何输出.什么可能导致这种情况?
Despite the fact that the swf contains traces, I am not getting any output from them in the console. What could be causing this?
推荐答案
为了从 Flash 获取跟踪,您需要运行 Flash Debugger (FDB).幸运的是,它带有 Flex SDK.(http://www.adobe.com/devnet/flex/flex-sdk-download.html)
In order to get traces from Flash you need to run the Flash Debugger (FDB). Luckily it comes with the Flex SDK. (http://www.adobe.com/devnet/flex/flex-sdk-download.html)
这是一个示例任务,我在 Ant 中使用它来启动 Flash 调试器,它反过来会启动您的浏览器,因为目标是一个 HTML 文件.如果目标是 SWF 文件,那么它只会在独立的 FDB 窗口中运行.
This is a sample task that I am using in Ant to launch the Flash Debugger, which in turn will launch your browser because the target is an HTML file. If the target was a SWF file then it would simply run in a standalone FDB window.
<target name="launch-browser">
<echo file="${basedir}/build/.fdbinit">run file://${outputdir}/swf/index.html
continue</echo>
<exec executable="${sdk.flex}bin/fdb" spawn="false" dir="build">
<arg line="-unit"/>
</exec>
</target>
此任务将首先写入一个名为 .fdbinit 的文件,其中包含 fdb 在启动时将运行的命令.然后它用 -unit 启动 fdb 以确保它正确地连接到 ant builder(我实际上不是 100%,但这是必需的).这将为您提供浏览器和终端窗口中的跟踪(也是实际的调试器控件).
This task will first write a file called .fdbinit which contains the commands that fdb will run when launched. Then it starts fdb with -unit to make sure it stays properly attached to the ant builder (I'm actually not 100% on this but it is required). This will give you the browser, and the traces (also the actual debugger control) in your terminal window.
--
或者,如果您的机器上安装了 Flash Debug Player,则使用您的原始宏定义;您可以通过编辑 mm.cfg 文件并设置 TraceOutputFileEnable 和 TraceOutputFileName 选项来配置您的 Flash Player 以将跟踪写入文件.
Alternatively, using your original macrodef, if you have the Flash Debug Player installed on your machine ; you can configure your Flash Player to write the traces to a file by editing your mm.cfg file and setting the TraceOutputFileEnable and TraceOutputFileName options.
此文件位于 OSX 上的/Library/Application Support/Macromedia.
This file is found in /Library/Application Support/Macromedia on OSX.
mm.cfg 的相关和附加文档:http://help.adobe.com/en_US/flex/using/WS2db4920e96a9e51e63e3d11c0bf69084-7fc9.html"-7fc9.html
Relevant and additional docs for mm.cfg:http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fc9.html
这篇关于为 exec ANT 任务启用控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!