Let’s assume you have a simple Image Display application built in Flex, which after being compiled has the .swf files size of 600kb.
I’ve got good news for you because there is a way to make your application up to 10 times smaller, so continue reading.

Step one:
Create a ‘Release‘ version of your application.
In previous Flex Builder verisons when you clicked the Debug button, Flex was creating for you the Debug and Release version of the application.
But now with Flex Builder 3 and Gumbo, you have to create the Release version your self, by clicking the ‘Release Build’ button, which should create a new folder named ‘bin-release‘. After clicking ‘Finish‘, your Release version of the application will be built. Now have a look inside the ‘bin-release‘ folder at the size of your new .swf file - it should be almost 2 times smaller in our case 250kb, which is still big.

Step two:
Next try to create a Flex Module from main your application, and add the module to the main application using

<mx:ModuleLoader url=&#8221;YourModuleName.swf”/>

Compile your Release version again, therefore your application .swf file should now be around 170kb which is still big! And it’s all because the entire Flex framework is included in your Release swf file, which you don’t really need to have.
Every time you visit a Flex content website, you are actualy downloading the same framework over and over again.
With the release of Flash Player 9 .0.1.25 a caching mechanism has been added for that framework, so you can avoid including the framewrok in your application as step three instructs.

Step Three:
You need to change the Framework Linkage to Runtime Shared Library (RSL). To do this you must go to ‘Project Properties > Flex Build Path > Framework Linkage’
Press the Release button again to make a new release version of your application.
Check the .swf file size, and you have around 50-70kb which makes a big size difference from 600kb.

Notice:
Flex Builder 3 (and Flash Builder 4 Gumbo) has now built two extra files for you, next to the main application .swf file, which represent the entire Flex framework files. You need to also add this two files on your website, to the same root level where the main application swf is located.
Those files will only get downloaded by visitors who never accessed a Flex 3 application site before, the rest won’t need them because they will probably have it cached.

Download examples (examples created using Flash Builder 4 Gumbo Beta):

AppFileSize_BIG.zip > This app swf size will be 654kb (/bin-debug/AppFileSize_BIG.swf)

AppFileSize_SMALL.zip > This app swf size will be 74kb (/bin-release/AppFileSize_SMALL.swf)

www.adriansule.com