zoukankan      html  css  js  c++  java
  • (转)使用Flex Ant Task+FDT+Eclipse+Flex SDK完成编译和debug

    转自 http://bbs.blueidea.com/forum.php?mod=viewthread&tid=2777520&reltid=2869739&pre_pos=2&ext=

    http://www.actionscript3.cn/magi ... eclipseflex_sd.html
    把fdt2.5.4直接安装在flex3 beta上,但是这样就算perspective切换到fdt上,一个很郁闷的问题就是,flex3太霸道了,只要project被load进来,fdt的代码功能就被flex屏蔽掉了,只有task、查错之类的功能还保存,让我很郁闷

    看了http://www.zhaohongri.cn/blog/read.php?4http://blog.eshangrao.com/index. ... -adobeflex-ant-task,自己修改成符合我要求的,测试通过啦

    我的project环境:
    actionscript3 project,在as2时代,kingda教会我的是fdt编辑好后在flash编译,但flash cs3实在太慢了,所以有段时间我一直在flex在进行as编辑和编译,只要以前用过fdt都会感到flex的编辑功能实在是应该加强。
    因为对aswing有很大的兴趣,有个很郁闷的问题就是,当你在flex下建立的as project使用aswing的as包时候,flex没有出现任何报错,但是我换成fdt后,as包就报出100个错(没有夸张啦),查错时候发现as包中真的蛮多错误的,所以我想到aswing提供的swc包,但在安装了fdt的flex就得在flex下设置swc包又得在fdt下设置--烦都烦死,主要还不能用到fdt的编辑,特别郁闷,经过几天google,发现上面的两个blog中的资料,直接用发现了一些问题,http://www.zhaohongri.cn/blog/read.php?4虽然能达到我的要求,但因为知道flex ant,所以直接自己弄一个感到不爽,http://blog.eshangrao.com/index. ... -adobeflex-ant-task倒是蛮不错,不过我比较笨,让我测试了慢久。

    综合这两个测试:
    1:下载到flex ant task,如果嫌麻烦,可以直接在http://blog.eshangrao.com/index. ... -adobeflex-ant-task下载那个代码包自己用下。
    2:下载flex的sdk,我是使用到flex3 beta的sdk,copy flex的sdks文件夹中的moxie到你想放置的地方比如D:/eclipse/flexSDK,这样是放置修改了会冲突
    3:在安装好fdt2.5.4的eclipse,具体参看http://www.kingda.org/archives/kingda/2007/08/as3idefdt3.html,新建一个flash project--“TestFDT”,新建一个source folder取名“src”,新建一个“bin”作为导出swf存放地点,之后自己写个TestFDT的document class作为后面测试使用。
    4:将flex ant task配置好,如果刚使用建议还是参考http://blog.eshangrao.com/index. ... -adobeflex-ant-task中提供的包,除了里面的src文件夹,其他都copy到“TestFDT”下。
    5:eclipse中打开build.xml,要注意的地方我用注释说明
    <?xml version="1.0" encoding="utf-8"?>
    <!-- by magicianzrh:仰慕下feiy,这么早前就写出了这个 -->
    <!-- author:feiy -->
    <!-- version:20070127 -->
    <!-- blog:http://blog.eshangrao.com -->
    <!-- email:eshangrao@gmail.com -->
    <!-- welcome join to the flex GTalk Group:flex.eshangrao@gmail.com -->
    <!-- by magicianzrh: basedir用来表明build.xml与项目跟目录的相对地址>
    <project name="Flex Ant Builder Sample Project" basedir=".">
    <!-- by magicianzrh:taskdef标签用于说明flexTask信息和地址property标签为设置ant脚本的参数,这些参数可以在ant运行中修改,因为在feiy中下载的包已经用e文注释过了,我就不多说了,只要注意地址不要出错就好了-->
    <taskdef resource="flexTasks.tasks" classpath="${basedir}/flexTasks/lib/flexTasks.jar" />
    <property name="FLEX_HOME" value="D:\eclipse\flexSDK" />
    <property name="APP_ROOT" value="src" />
    <property name="DEPLOY_DIR" value="bin" />
    <!-- compiled mxml/as file Name -->
    <property name="fileName" value="" />
    <!-- compiled mxml/as file ext -->
    <!-- by magicianzrh:这里的flieExt的参数指的是后缀,我认为修改了下,因为我只是编译as,不考虑mxml,如果要这方面要求的朋友,只要留空,在最后编译设置那修改也是可以的-->
    <property name="fileExt" value="as" />
    <!-- modular application's main application fileName -->
    <property name="mainApp" value="" />
    <!-- output package direction,end with / -->
    <property name="package" value="" />
    <!-- compile a mxml/as file -->
    <target name="compile" depends="cleanCompile">
    <mxmlc file="${APP_ROOT}/${package}${fileName}.${fileExt}" output="${DEPLOY_DIR}/${package}${fileName}.swf" actionscript-file-encoding="UTF-8" keep-generated-actionscript="false" incremental="true">
    <!-- Get default compiler options. -->
    <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
    <!-- List of path elements that form the roots of ActionScript class hierarchies. -->
    <source-path path-element="${FLEX_HOME}/frameworks" />
    <!-- List of SWC files or directories that contain SWC files. -->
    <!-- 要使用的SWC包存放地点啦,按我这篇文章就是D:/eclipse/flexSDK/frameworks/lib中了-->
    <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
    <include name="libs" />
    <include name="../bundles/{locale}" />
    </compiler.library-path>
    <!-- Set size of output SWF file.
    by magicianzrh:这个我就不说啦,不过我还是喜欢在as中设置-->
    <default-size width="1000" height="600" />
    </mxmlc>
    <delete>
    <!-- Deletes cache file -->
    <fileset dir="${APP_ROOT}/${package}" includes="${fileName}*.cache" defaultexcludes="false" />
    </delete>
    </target>
    <!-- compile mxml file and Generate a Link Report for the embed module -->
    <target name="CompileAndGenerateLinkReport">
    <mxmlc file="${APP_ROOT}/${package}${fileName}.${fileExt}" link-report="${APP_ROOT}/${package}${fileName}_LinkReport.xml" output="${DEPLOY_DIR}/${package}${fileName}.swf" actionscript-file-encoding="UTF-8" keep-generated-actionscript="false" incremental="true">
    <!-- Get default compiler options. -->
    <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
    <!-- List of path elements that form the roots of ActionScript class hierarchies. -->
    <source-path path-element="${FLEX_HOME}/frameworks" />
    <!-- List of SWC files or directories that contain SWC files. -->
    <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
    <include name="libs" />
    <include name="../bundles/{locale}" />
    </compiler.library-path>
    <!-- Set size of output SWF file. -->
    <default-size width="500" height="600" />
    </mxmlc>
    <delete>
    <!-- Deletes cache file -->
    <fileset dir="${APP_ROOT}/${package}" includes="${fileName}*.cache" defaultexcludes="false" />
    </delete>
    </target>
    <!-- compile Modular mxml file with mainApp's Link Report -->
    <target name="CompileModuleWithLinkReport">
    <mxmlc file="${APP_ROOT}/${package}${fileName}.${fileExt}" load-externs="${APP_ROOT}/${mainApp}_LinkReport.xml" output="${DEPLOY_DIR}/${package}${fileName}.swf" actionscript-file-encoding="UTF-8" keep-generated-actionscript="false" incremental="true">
    <!-- Get default compiler options. -->
    <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
    <!-- List of path elements that form the roots of ActionScript class hierarchies. -->
    <source-path path-element="${FLEX_HOME}/frameworks" />
    <!-- List of SWC files or directories that contain SWC files. -->
    <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
    <include name="libs" />
    <include name="../bundles/{locale}" />
    </compiler.library-path>
    <!-- Set size of output SWF file. -->
    <default-size width="500" height="600" />
    </mxmlc>
    <delete>
    <!-- Deletes cache file -->
    <fileset dir="${APP_ROOT}/${package}" includes="${fileName}*.cache" defaultexcludes="false" />
    </delete>
    </target>
    <!-- wrapper a swf with html express-installation template-->
    <target name="wrapper" depends="cleanWrapper">
    <html-wrapper title="Flex Ant Builder Sample" width="100%" height="100%" application="flexApp" swf="${fileName}" version-major="9" version-minor="0" version-revision="0" history="true" template="express-installation" output="${DEPLOY_DIR}/${package}" />
    <move file="${DEPLOY_DIR}/${package}index.html" tofile="${DEPLOY_DIR}/${fileName}.html" />
    </target>
    <!-- clean preview previous compile file -->
    <target name="cleanCompile">
    <delete dir="${APP_ROOT}/${package}generated" />
    <delete>
    <fileset dir="${DEPLOY_DIR}/${package}" includes="${fileName}*.swf" />
    </delete>
    </target>
    <!-- clean preview previous wrapper file -->
    <target name="cleanWrapper">
    <delete>
    <!-- Deletes history.swf -->
    <fileset dir="${DEPLOY_DIR}/${package}" includes="history.swf" defaultexcludes="false" />
    <!-- Deletes playerProductInstall.swf -->
    <fileset dir="${DEPLOY_DIR}/${package}" includes="playerProductInstall.swf" defaultexcludes="false" />
    <!-- Deletes ${fileName}.html -->
    <fileset dir="${DEPLOY_DIR}/${package}" includes="${fileName}*.html" defaultexcludes="false" />
    <!-- Deletes history.htm -->
    <fileset dir="${DEPLOY_DIR}/${package}" includes="$history.htm" defaultexcludes="false" />
    <!-- Deletes history.js and AC_OETags.js -->
    <fileset dir="${DEPLOY_DIR}/${package}" includes="*.js" defaultexcludes="false" />
    </delete>
    </target>
    </project>

    如果目的跟我差不多的只要关注下compile标签就可以了,其他标签分别是导出swc、mondule开发模式以及生成html的,总之是蛮全面的,可以参考labs.adobe.com中文档说明。

    6:修改flexSDK/frameworks/flex-config.xml(学到http://www.zhaohongri.cn/blog/read.php?4的)
    查找source-path标签和debug标签
    修改为

    其中source-path中的path-element修改为你flash cs3的类库
    D:\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0\Classes是我安装目录,大家安装自己的就可以了

    debug设置为true

    7:eclipse中右键build.xml,Run as -> open extanel tools dialog,Ant Builder中右边targets选中compile标签,这样是让运行时候运行哪个便签块,所以你有其他用途就选其他的啦。
    Main标签中的Argument中可以设置build.xml中property标签的参数,只要-D+"property 标签中的name之"=××就可以啦,比如现在我要编译TestFDT.as只要-DfileName=TestFDT就OK啦,因为fileExt我已经写入了xml

    8:还是在extanel tools dialog中,在program中新建一个,location中找到flexSDK\bin\fdb.exe,Working Directory中Browser File System选中TestFDT项目中的bin文件夹,为ant编译出来的swf对应位置,argument中输入编译后出来的swf名字,build.xml决定了这个名字,是fileName+.swf,就是说目前这个就是TestFDT.swf

    之后就完全OK啦

    右键你的build.xml试试run下就调用了compile区域编译出TestFDT.swf在bin文件夹,之后在extanel tools dialog中的刚才新建的program试试run下,就是调试swf啦,在console面板中输入continue就开始看到trace信息啦
  • 相关阅读:
    git 好文引流
    无法访问Swagger 或 druid面板无法访问 #报异常
    MachineLearning入门-7(数据理解)
    MachineLearning入门-6(数据导入)
    MachineLearning入门-5(Python和Scipy简介)
    百度PaddlePaddle入门-10(数据处理)
    百度PaddlePaddle入门-9(建模)
    百度PaddlePaddle入门-8(模型探讨)
    MachineLearning入门-4(理解数据集)
    百度PaddlePaddle入门-7 (Numpy的应用)
  • 原文地址:https://www.cnblogs.com/xbglbc/p/2342740.html
Copyright © 2011-2022 走看看