环境配置:

1.安装32位Java,经测试可用的 链接:http://pan.baidu.com/s/1i4CraXR 密码:xuud

2.ant,链接:http://pan.baidu.com/s/1hs41La8 密码:va05

3.系统环境变量Path,加入%JAVA_HOME%\bin;D:\androidDevlop\ant\bin;

JAVA_HOME:没有的则新建,赋值:C:\Program Files (x86)\Java\jre6

4.一切配置完成打开命令行分别输入java , ant测试是否成功,检查无误重启电脑

5.一切完成如果以下步骤还不能打包可能要重启FlashDevelop


注意:不支持链接其它swc

具体步骤:

1.Project - New Project - AS3 Library SWC

2.编辑主文档类内容

3.F8/Project - Build Project

4.即可在lib文件夹下看到打包好的swc,展开swc文件找到类名双击打开则可以看到封装好的方法及属性

当调用air的API时注意修改build.xml

取消注释的两行即可

air如果没有代码提示则修改项目属性把output-platform改为AIR就可以了

<project name="mySWC" default="build">

    <property environment="env" />
<fail unless="env.FLEX_HOME" message="FLEX_HOME needs to be defined as an environment variable or in the Ant build." />
<property name="FLEX_HOME" location="${env.FLEX_HOME}" /> <property name="OUTPUT" location="lib/mySWC.swc"/> <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/> <target name="build"> <mkdir dir="lib" /> <!-- compile SWC -->
<compc output="${OUTPUT}">
<!-- <load-config filename="${FLEX_HOME}/frameworks/air-config.xml" /> --> <!-- uncomment for AIR -->
<sp path-element="src" />
<include-sources dir="src" includes="*" />
</compc> <!-- generate documentation -->
<asdoc output="lib/tempDoc" lenient="true" failonerror="true" keep-xml="true" skip-xsl="true" fork="true">
<!-- <load-config filename="${FLEX_HOME}/frameworks/air-config.xml" /> --> <!-- uncomment for AIR -->
<sp path-element="src"/>
<doc-sources path-element="src" />
</asdoc> <!-- inject documentation inside SWC -->
<zip destfile="${OUTPUT}" update="true">
<zipfileset dir="lib/tempDoc/tempdita" prefix="docs">
<include name="*.*"/>
<exclude name="ASDoc_Config.xml"/>
<exclude name="overviews.xml"/>
</zipfileset>
</zip> <!-- cleanup -->
<delete dir="lib/tempDoc" />
</target>
</project>

05-02 20:49