I was trying to create an automation script for some of the projects in Adobe Flex 4 the other day and I realised that the ant build is generating a far more bigger swf file (in terms of the file size)than the ones created using bin-release. After numerous attempts, I finally managed to compress the file size to match the ones that that were generated using bin-release.
<!-- Within the <mxmlc> tag of your ant script, you need to add the following. And take note of the comments below --> <mxmlc> <static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries> <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/textLayout.swc"> <!-- If you are copying and pasting, do take note that 'textLayout_1.0.0.595.swz' isn't in the 'flex/' folder but the 'tlf/' folder under 'http://fpdownload.adobe.com/pub/swz/' --> <url rsl-url="http://fpdownload.adobe.com/pub/swz/tlf/1.0.0.595/textLayout_1.0.0.595.swz" policy-file-url="http://fpdownload.adobe.com/pub/swz/crossdomain.xml"/> <url rsl-url="textLayout_1.0.0.595.swz" policy-file-url="" /> </runtime-shared-library-path> <!-- If you are copying and pasting, do take note that 'framework.swc' needs to be included before the other 'swz' that belongs to the same 'flex/' folder under 'http://fpdownload.adobe.com/pub/swz/', otherwise errors will occur when you run the web application. --> <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/framework.swc"> <url rsl-url="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/framework_4.5.0.20967.swz" policy-file-url="http://fpdownload.adobe.com/pub/swz/crossdomain.xml"/> <url rsl-url="framework_4.0.0.14159.swz" policy-file-url="" /> </runtime-shared-library-path> <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/spark.swc"> <url rsl-url="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/spark_4.5.0.20967.swz" policy-file-url="http://fpdownload.adobe.com/pub/swz/crossdomain.xml"/> <url rsl-url="spark_4.0.0.14159.swz" policy-file-url="" /> </runtime-shared-library-path> <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/sparkskins.swc"> <url rsl-url="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/sparkskins_4.5.0.20967.swz" policy-file-url="http://fpdownload.adobe.com/pub/swz/crossdomain.xml"/> <url rsl-url="sparkskins_4.0.0.14159.swz" policy-file-url="" /> </runtime-shared-library-path> <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/rpc.swc"> <url rsl-url="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/rpc_4.5.0.20967.swz" policy-file-url="http://fpdownload.adobe.com/pub/swz/crossdomain.xml"/> <url rsl-url="rpc_4.0.0.14159.swz" policy-file-url="" /> </runtime-shared-library-path> <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/charts.swc"> <url rsl-url="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/charts_4.5.0.20967.swz" policy-file-url="http://fpdownload.adobe.com/pub/swz/crossdomain.xml"/> <url rsl-url="charts_4.5.0.20967.swz" policy-file-url="" /> </runtime-shared-library-path> <!-- If you are copying and pasting, do take note that 'mx.swc' isn't in the 'libs/' folder but the 'libs/mx/' folder under '${FLEX_HOME}/frameworks/libs/' --> <runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/mx/mx.swc"> <url rsl-url="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/mx_4.5.0.20967.swz" policy-file-url="http://fpdownload.adobe.com/pub/swz/crossdomain.xml"/> <url rsl-url="mx_4.5.0.20967.swz" policy-file-url="" /> </runtime-shared-library-path> </mxmlc>* Click here for a great guide on creating the ant automation file for your flex 4 project.
No comments:
Post a Comment