如何让我的Ant生成的swf尽可能小?

Roa*_*ers 5 apache-flex ant mxmlc flex4

我有一个flex项目,如果我在swf上使用带有RSL的Flash Builder构建应用程序的发行版本是115k.但是,如果我使用ant构建相同的应用程序,则swf为342k.没有RSL,swf是520k.

如何使swf与FlashBuilder构建的swf一样小?

这是我的ant文件,我有另一个复制rsls的任务.

<project name="EUI Client Application" default="compileClientApp">

<target name="compileClientApp" depends="compileClientBundles">
    <mxmlc 
        file="${CLIENT_PROJECT.dir}/src/${CLIENT_PROJECT.app}.mxml" 
        output="${DEPLOY.dir}/${CLIENT_PROJECT.app}.swf" 
        keep-generated-actionscript="false" 
        actionscript-file-encoding="UTF-8" 
        incremental="false"
        >

        <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/framework.swc">
            <url rsl-url="flex4_4.0.0.7791.swf"/>
            <url rsl-url="framework_4.0.0.7791.swf"/>
            <url rsl-url="framework_textLayout_4.0.0.7791.swf"/>
            <url rsl-url="rpc_4.0.0.7791.swf"/>
            <url rsl-url="textLayout_451.swf"/>
        </runtime-shared-library-path>

        <source-path path-element="${CLIENT_PROJECT.dir}/src" />

        <compiler.library-path dir="${LIBS.dir}" append="true">
            <include name="*.swc" />
        </compiler.library-path>
        <compiler.library-path dir="${DEPLOY_BIN.dir}" append="true">
            <include name="*.swc" />
        </compiler.library-path>

    </mxmlc>
</target>

<target name="generateWrapper">
    <html-wrapper 
        title="${CLIENT_APP_TITLE}" 
        file="${CLIENT_PROJECT.app}.html" 
        height="100%" width="100%" 
        bgcolor="white" application="app" 
        swf="${CLIENT_PROJECT.app}" 
        version-major="10" version-minor="0" version-revision="0" 
        history="true" output="${DEPLOY.dir}" />
</target>

<target name="compileClientBundles">
    <compileBundle bundleName="Modules" source="${CORE_PROJECT.dir}/locale" />
</target>
Run Code Online (Sandbox Code Playgroud)

Roa*_*ers 2

感谢各位的回复,但不是其中任何一个。

事实证明,我需要做的就是删除运行时共享库​​路径的内容,因为它已经在 flex-config.xml 文件中了。我还必须将 static-link-runtime-shared-libraries 更改为 false (因此它是动态的)。

我已将 flex-config.xml 文件复制到我的构建目录中并使用它,以便我可以安全地进行更改。

这是 Flex 4 顺便说一句 - 不确定我是否说得很清楚。

我的 ant 文件现在看起来像这样:

<project name="EUI Client Application" default="compileClientApp">

<target name="compileClientApp" depends="compileClientBundles">
    <mxmlc 
        file="${CLIENT_PROJECT.dir}/src/${CLIENT_PROJECT.app}.mxml" 
        output="${DEPLOY.dir}/${CLIENT_PROJECT.app}.swf" 
        keep-generated-actionscript="false" 
        actionscript-file-encoding="UTF-8" 
        optimize="true" incremental="false"
        link-report="${DEPLOY_BIN.dir}/app_link_report.xml"
        >

        <load-config filename="${basedir}/flex-config.xml" />

        <define name="CONFIG::stub" value="false" />
        <define name="CONFIG::release" value="true" />

        <source-path path-element="${CLIENT_PROJECT.dir}/src" />

        <compiler.library-path dir="${LIBS.dir}" append="true">
            <include name="*.swc" />
        </compiler.library-path>
        <compiler.library-path dir="${DEPLOY_BIN.dir}" append="true">
            <include name="*.swc" />
        </compiler.library-path>
    </mxmlc>
</target>

<target name="generateWrapper">
    <html-wrapper 
        title="${CLIENT_APP_TITLE}" 
        file="${CLIENT_PROJECT.app}.html" 
        height="100%" width="100%" 
        bgcolor="white" application="app" 
        swf="${CLIENT_PROJECT.app}" 
        version-major="10" version-minor="0" version-revision="0" 
        history="true" output="${DEPLOY.dir}" />
</target>

<target name="compileClientBundles">
    <compileBundle bundleName="Modules" source="${CORE_PROJECT.dir}/locale" />
</target>
Run Code Online (Sandbox Code Playgroud)