弹性 4 + Apache Ant,无法加载 ActionScript 库
我一直在 google、Apache Docs* 和 FlashPunk 论坛中搜索,寻找这个问题的答案:我无法让 Ant/Flex 查找并编译 *.AS 格式的库文件夹。
这是我的 build.xml。
<project>
<!-- Flex SDK Properties -->
<property name="FLEX_HOME" value="/opt/flex"/>
<property name="MXMLC.JAR" value="${FLEX_HOME}/lib/mxmlc.jar"/>
<!-- Project Properties -->
<property name="PROJECT_PATH"
value="/media/Lexar_32G/Dev/ActionScript/FlashPunk/FP_Tut_Vid_ep01"/>
<property name="SOURCE_PATH" value="${PROJECT_PATH}"/>
<property name="OUTPUT_PATH" value="${PROJECT_PATH}"/>
<property name="FLASHPUNK_PATH" value="/media/Lexar_32G/Dev/ActionScript/FlashPunk"/>
<!-- Fetch the JAR full of Flex tasks if it is not already in the source directory -->
<copy file="${FLEX_HOME}/ant/lib/flexTasks.jar" todir="${SOURCE_PATH}"/>
<!-- Add flextasks to the project -->
<taskdef resource="flexTasks.tasks" classpath="${SOURCE_PATH}/flexTasks.jar"></taskdef>
<!-- Release build Flash Player 10.1 -->
<target name="build">
<!-- Build the FlashPunk library -->
<echo message="building swc..." />
<compc output="FlashPunk.swc" keep-generated-actionscript="false"
incremental="false" optimize="false" debug="true" use-network="false">
<include-sources dir="${FLASHPUNK_PATH}/net"
includes="**/* flashpunk/utils/* flashpunk/masks/*"
excludes="**/*.TTF **/*.png"/>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
</compc>
<echo message="building swf..." />
<mxmlc
file="${SOURCE_PATH}/epOne.as"
output="${OUTPUT_PATH}/epOne.swf"
debug="false"
incremental="false"
strict="true"
accessible="false"
link-report="link_report.xml"
static-link-runtime-shared-libraries="true">
<optimize>true</optimize>
</mxmlc>
</target>
导致许多“定义 net.flashpunk.masks:无法找到网格”类型的错误,即使当我打开目录时我可以在那里看到 *.AS 文件。
抱歉,如果这是非常基本的。我正在从文档和教程中拼凑 Ant 知识。
*我决定使用 Ant,因为 Windows 版 FlashDevelop 和 Linux 版 Eclipse 似乎都不适合我。
I have been searching google, Apache Docs*, and FlashPunk forums looking for an answer to this: I cannot get Ant/Flex to find and compile a folder of libraries in *.AS format.
Here is my build.xml.
<project>
<!-- Flex SDK Properties -->
<property name="FLEX_HOME" value="/opt/flex"/>
<property name="MXMLC.JAR" value="${FLEX_HOME}/lib/mxmlc.jar"/>
<!-- Project Properties -->
<property name="PROJECT_PATH"
value="/media/Lexar_32G/Dev/ActionScript/FlashPunk/FP_Tut_Vid_ep01"/>
<property name="SOURCE_PATH" value="${PROJECT_PATH}"/>
<property name="OUTPUT_PATH" value="${PROJECT_PATH}"/>
<property name="FLASHPUNK_PATH" value="/media/Lexar_32G/Dev/ActionScript/FlashPunk"/>
<!-- Fetch the JAR full of Flex tasks if it is not already in the source directory -->
<copy file="${FLEX_HOME}/ant/lib/flexTasks.jar" todir="${SOURCE_PATH}"/>
<!-- Add flextasks to the project -->
<taskdef resource="flexTasks.tasks" classpath="${SOURCE_PATH}/flexTasks.jar"></taskdef>
<!-- Release build Flash Player 10.1 -->
<target name="build">
<!-- Build the FlashPunk library -->
<echo message="building swc..." />
<compc output="FlashPunk.swc" keep-generated-actionscript="false"
incremental="false" optimize="false" debug="true" use-network="false">
<include-sources dir="${FLASHPUNK_PATH}/net"
includes="**/* flashpunk/utils/* flashpunk/masks/*"
excludes="**/*.TTF **/*.png"/>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
</compc>
<echo message="building swf..." />
<mxmlc
file="${SOURCE_PATH}/epOne.as"
output="${OUTPUT_PATH}/epOne.swf"
debug="false"
incremental="false"
strict="true"
accessible="false"
link-report="link_report.xml"
static-link-runtime-shared-libraries="true">
<optimize>true</optimize>
</mxmlc>
</target>
Results in many errors of the type "Definition net.flashpunk.masks:Grid could not be found" even though when I open the directories I can see the *.AS files right there.
Sorry if this is very basic. I am piecing together knowledge of Ant from docs and tutorials.
*I decided to use Ant because neither FlashDevelop for Windows nor Eclipse for Linux seemto work for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这(基本上)是固定的。我没有达到只拥有一份未编译的 FlashPunk 库的目标,但我能够通过将整个库复制到我的源路径来至少编译 SWF。还好它没那么大。
Apache Ant 命令看起来像这样:
事实证明不需要额外的命令来让 Flex 为我设置命名空间。此外,在编译最终的 SWF 之前,我不再尝试将库编译为 SWC。因此,生成的 build.xml 看起来像这样:
很简单,不是吗?
This was (basically) fixed. I did not meet my goal of having only one copy of the uncompiled FlashPunk library, but I was able to get the SWF to at least compile by copying the entire library to my source path. Good thing it wasn't that large anyway.
Apache Ant command looks like so:
Did not turn out to need extra commands to let Flex set up the namespaces for me. Additionally, I stopped trying to compile the library as a SWC before I compiled the final SWF. Therefore, the resulting build.xml looks like so:
Simple, no?