Skip to content

Instantly share code, notes, and snippets.

@zrong
Created April 27, 2011 17:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zrong/944712 to your computer and use it in GitHub Desktop.
Save zrong/944712 to your computer and use it in GitHub Desktop.
ant编译swf的选项(mxmlc的简单编译)
# 设置FLEX SDK的路径
FLEX_HOME=c:/Program Files/Adobe/FlashBuilder4Plug-in/sdks/4.1.0
# 设置源文件路径
# {$basedir} 就是本文件所在的目录
SRC_DIR =${basedir}/src
# libs目录,一般用来放swc文件
LIBS_DIR =${basedir}/libs
# 这个就是Flash Builder建立的bin-debug
DEPLOY_DIR = ${basedir}/bin-debug
#自定义的类库源码
LIBS_DUDU = e:/works/duduw_as3lib/src
<project name="kv7" default="build">
<!-- 载入配置文件 -->
<property file="build.properties" />
<!-- 确定flexTasks.jar的位置 -->
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
<target name="build" depends="init,compile,fdb" />
<!-- 清理部署目录中的内容 -->
<target name="init">
<delete dir="${DEPLOY_DIR}/run_test.swf" />
<delete dir="${DEPLOY_DIR}/assets" />
<!-- 将资源目录复制到部署目录 -->
<copy todir="${DEPLOY_DIR}/assets">
<fileset dir="${SRC_DIR}/assets" />
</copy>
</target>
<!-- 编译 -->
<target name="compile">
<mxmlc file="${SRC_DIR}/RunTest.as" output="${DEPLOY_DIR}/run_test.swf">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${LIBS_DUDU}" />
<!-- 需要libs的时候解开注释
<compiler.library-path dir="${basedir}" append="true">
<include name="libs" />
</compiler.library-path>
-->
<!-- 必须加上这行,如果不加,当使用[Embed]的标签的时候,就会出现VerifyError: Error #1014: 无法找到类 。 原因应该是没有将mx.core包编译进入。官方文档说这个属性默认是true, 不要相信它-->
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<!-- 编译成可调试的版本 -->
<compiler.debug>true</compiler.debug>
</mxmlc>
</target>
<!-- 打开调试器进行调试 -->
<target name="fdb">
<!-- 不能直接调用fdb,因为这样不会打开新的命令行窗口,必须使用/K或者/C参数,加上start来启动fdb -->
<exec executable="cmd" spawn="true" osfamily="windows">
<arg line="/K start fdb ${DEPLOY_DIR}/run_test.swf" />
</exec>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment