How to make my Ant generated swf as small as possible?

I have a flex project, and if I create a version for the version of the application using the Flash constructor with RSL files on my swf, it is 115k. If, however, I create the same application using ant, swf - 342k. Without RSL, SWF is 520 thousand.

How to make swf be as small as the one created by FlashBuilder?

Here is my ant file, I have another task that copies 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>

+5
source share
4 answers

Thanks for the answers to the guys, but it was neither one nor the other.

, , , , flex-config.xml. static-link-runtime-shared-false false ( ).

flex-config.xml , .

Flex 4 BTW - .

my 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>

+2

, libs, -external-library-path.

. .

RSL , :

* runtime-shared-libraries Provides the run-time location of the shared library.
* external-library-path|externs|load-externs Provides the compile-time location of the libraries. The compiler requires this for dynamic linking.

runtime-shared-libraries, SWF , RSL . SWF . , library.swf web_root/libraries - -, /library.swf.

. , .

" ", SWC , . , . externs load-externs XML , .

MyApp, :

mxmlc -runtime-shared-libraries =.. /libraries/CustomCellRenderer/library.swf,../libraries/CustomDataGrid/library.swf - - =..//CustomCellRenderer,.. /libraries/CustomDataGrid MyApp.mxml

, , .

, :

             .. /libraries/CustomCellRenderer         .. /libraries/CustomDataGrid         .. /libs/playerglobal.swc          .. /libraries/CustomCellRenderer/library.swf     .. /libraries/CustomDataGrid/library.swf

run-shared-libraries - library.swf, . External-library-path - SWC . - . , compc SWC.

+1

RSL . :

<runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/framework.swc">
    <url rsl-url="${rsl.url}/framework_3.2.0.3958.swz" />
    <url rsl-url="${rsl.url}/framework_3.2.0.3958.swf" />
</runtime-shared-library-path>

<runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/datavisualization.swc">
    <url rsl-url="${rsl.url}/datavisualization_3.2.0.3958.swz" />
    <url rsl-url="${rsl.url}/datavisualization_3.2.0.3958.swf" />
</runtime-shared-library-path>
+1

RSL, use-network true, swf ( RSL) .

0

All Articles