如何使用命令行编译 Flash .FLAs?

发布于 2024-09-29 22:42:38 字数 196 浏览 4 评论 0原文

如何使用命令行编译 Flash .FLAs?

我正在使用 Eclipse + FDT 进行 Flash 开发,我想使用 ANT 来自动化编译。

我使用的是 AS3,需要针对 Flash Player 10.1 进行编译。

非常感谢

更新:我需要编译 .FLA,因为这是我从我们的设计师那里得到的。

how do I compile Flash .FLAs using command line?

I am using Eclipse + FDT for Flash development and I would like to use ANT to automatize the compilation.

I am using AS3 and need to compile for Flash Player 10.1.

Many thanks

Update: I need to compile .FLAs because that's what I get from our designers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

请恋爱 2024-10-06 22:42:38

总结一下其他答案中可能不明显的内容:FLA 文件并不完全是“源”,而更像是 Flash 创作工具的项目文件,唯一知道如何编译它们的是该工具。如果您有 Flash Professional 并且它是打开的,则其他工具(或命令行)可以告诉它进行编译,但这是您能做的最好的事情,除非您以某种方式更改您的工作流程 - 例如从您的文件中获取除 FLA 之外的其他内容。设计人员,或者您将脚本、SWC 等提供给设计人员供他们导入和编译。

话虽如此,在最新版本中,Adobe 已将 FLA 文件从以前的样子(创作工具的二进制内存转储)更改为更易于访问的充满 XML 和图像等的压缩文件夹,因此在未来,第三方工具应该可以利用 FLA 做一些有用的事情。但目前,该 XML 的格式显然还不稳定,而且我还没有听说有任何其他工具开始处理 FLA。

To sum up what might not be apparent in the other answers: FLA files are not exactly "source", but more like project files for the Flash authoring tool, and the only thing that knows how to compile them is that tool. If you have Flash Professional and it's open, it's possible for other tools (or the command line) to tell it to compile, but that's the best you can do unless you change your workflow somehow - such as by getting something other than FLAs from your designers, or by you giving scripts, SWCs, etc. to the designers for them to import and compile.

With that said, in the most recent version Adobe has changed FLA files from what they used to be (a gory binary memory dump of the authoring tool) into a much more accessible zipped folder full of XML and images and so forth, so in the future it should become feasible for 3rd party tools to do something useful with FLAs. But at the moment, the format of said XML is apparently not stable yet, and I haven't heard of any other tools starting to process FLAs yet.

就此别过 2024-10-06 22:42:38

在flex sdk文件夹中,有一个ant/lib/flexTasks.jar,可以是与 ant 一起使用轻松构建 Flex 应用程序。

<?xml version="1.0" encoding="utf-8"?>
<!-- build.xml -->
<project name="My App Builder" basedir=".">
  <property name="FLEX_HOME" value="C:/flex/sdk"/>
  <taskdef resource="flexTasks.tasks"
      classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
  <property name="APP_ROOT" value="myApp"/>
  <target name="main">
      <mxmlc file="${APP_ROOT}/Main.mxml" keep-generated-actionscript="true">
          <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
          <source-path path-element="${FLEX_HOME}/frameworks"/>
      </mxmlc>
  </target>
</project>

编辑

FLA 格式有点单一且难以合并。当然,您可以告诉设计人员从创作工具甚至从 从命令行

但如果您要添加 AS3 脚本并将多个 FLA 文件合并在一起,您可能需要重新考虑您的管道。也许设计人员应该为您提供 MXML 文件 。 MXML 是一种 XML 标记语言,用于布局用户界面组件。然后使用图像、MXML 和 AS 文件从命令行构建 SWF。

In the flex sdk folder, there is a ant/lib/flexTasks.jar that can be used with ant to easily build flex applications.

<?xml version="1.0" encoding="utf-8"?>
<!-- build.xml -->
<project name="My App Builder" basedir=".">
  <property name="FLEX_HOME" value="C:/flex/sdk"/>
  <taskdef resource="flexTasks.tasks"
      classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
  <property name="APP_ROOT" value="myApp"/>
  <target name="main">
      <mxmlc file="${APP_ROOT}/Main.mxml" keep-generated-actionscript="true">
          <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
          <source-path path-element="${FLEX_HOME}/frameworks"/>
      </mxmlc>
  </target>
</project>

EDIT

The FLA format is kind of monolithic and hard to merge. Of course, you can tell your designers to export the FLA as a SWF file from the authoring tool or even from the from the command line.

But if you are adding AS3 scripting and merging several FLA files together, you may want to rethink your pipeline. Perhaps designers should be giving you MXML files. MXML is an XML markup language that you use to lay out user interface components. Then build your SWF from the command line using images, MXML, and AS files.

追星践月 2024-10-06 22:42:38

如果您使用 FDT,则无需执行任何操作。只要知道 Flex SDK(编译器)位置,它就会将其与所需的命令行参数一起使用 - 只需创建一个启动配置文件并使用它。

如果您需要在编译之前执行高级任务,则仅需要 ANT。即使在这种情况下,您也可以使用要在启动配置文件运行之前运行的命令来设置 ANT 任务,而不是在 ANT 中进行编译。

现在,如果您确实需要从 ANT 任务进行编译,您可以使用类似这样的东西...

<target name="web_compileDebug">
    <exec executable="${flexdir}/bin/mxmlc.exe" failonerror="true">
        <arg line="'./source/org/package/DocumentClass.as'"/>
        <arg line="-source-path './source'"/>
        <arg line="-default-frame-rate=60"/>
        <arg line="-default-background-color=0xFFFFFF"/>
        <arg line="-default-size 640 480"/>
        <arg line="-strict=true"/>
        <arg line="-warnings=true"/>
        <arg line="-debug=true"/>
        <arg line="-output './deploy/index.swf'"/>
        <arg line="-target-player=10.0.0"/>
        <arg line="-use-network=false"/>
    </exec>
</target>

当然,将其替换为您的 Flex SDK 位置或变量。

如果您打算编译 .FLA 文件,那么当然不能通过普通命令行完成 - 您需要使用 触发 Flash 并编译文件的 JSFL 脚本

If you're using FDT, you don't need to do anything. As long as the Flex SDK (compiler) location is known, it'll use it with the needed command line parameters - just create a launch profile and use it.

You only need ANT if you have advanced tasks you need to perform prior to compiling. And even in that case, you can set an ANT task with your commands to be ran before a launch profile runs instead of compiling within ANT.

Now, if you really need to compile from an ANT task, you use something like this...

<target name="web_compileDebug">
    <exec executable="${flexdir}/bin/mxmlc.exe" failonerror="true">
        <arg line="'./source/org/package/DocumentClass.as'"/>
        <arg line="-source-path './source'"/>
        <arg line="-default-frame-rate=60"/>
        <arg line="-default-background-color=0xFFFFFF"/>
        <arg line="-default-size 640 480"/>
        <arg line="-strict=true"/>
        <arg line="-warnings=true"/>
        <arg line="-debug=true"/>
        <arg line="-output './deploy/index.swf'"/>
        <arg line="-target-player=10.0.0"/>
        <arg line="-use-network=false"/>
    </exec>
</target>

Of course, replace that with your Flex SDK locations or variables.

If you mean to compile .FLA files, then of course that cannot be done by a normal command line - you need to use a JSFL script that fires Flash and compiles the file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文