我有一个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>
解决方法
感谢回复的人,但它不是那些.
事实证明,我需要做的就是删除运行时共享库路径的东西,因为这已经存在于flex-config.xml文件中.我还必须将static-link-runtime-shared-libraries更改为false(因此它是动态的).
我已将flex-config.xml文件复制到我的构建目录中并使用它,以便我可以安全地进行更改.
这是使用Flex 4 BTW – 不确定我是否非常清楚.
我的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>