使用ANT脚本导出发布版SWF(AIRSDK14)

使用ant脚本可以很方便的构建发布自己的项目,尤其是对于多语言多平台的版本,人工发布即费时,又容易漏掉东西,这些工作就交给脚本吧,机器就擅长干这个! 网上的关于ant的资料更多是用flex的sdk,但是现在移动开发一般都是在FB4.7里用的airsdk,经博主尝试以后,基本做法是一样的,ant的安装就不赘述了,自行搜索即可。下面就贴出相关代码:   build.xml如下: [codesyntax lang=”actionscript3”]

<compiler.library-path dir=”${FLEX_HOME}/frameworks” append=”true”>


</compiler.library-path>
24

    <delete dir="${APP\_OUTPUT\_PATH}/generated"/>
    <delete>
        <fileset dir="${APP\_OUTPUT\_PATH}" includes="${APP\_NAME}.swf.cache"/>
    </delete>

[/codesyntax] 建的测试项目是 testant,相关路径设定需要根据实际情况调整 调用ant脚本,使用FB继承的ant,也很方便,不过博主发现,在控制台打印信息时,中文会乱码,暂时还没有找到解决方法,另外一种就是通过bat批处理来直接调用。 bat脚本如下:

call ant -f build.xml swf

一行脚本即可搞定,build.xml 后跟的swf是xml文件里的target名,建议保存成bat文件,方便使用!

2014.6.10补充: 如果生成swf时候调用到ane,需要把ane改名为swc文件,以外部库的方式添加进来 从国外网站看到的,原文如下:

I can’t explain why, but if you copy and rename your .ane file and change them to .swc files (literally copy and rename, no conversion) and then reference the ANE’s directory as an external library path – it works. 原文链接

<compiler.external-library-path dir=”${ANE_DIR}” includes=”*.swc” append=”true” />