- Home
- Articles
- Best Practices
- How to decrease a Flex application files size (FB 3 & FB 4 Gumbo)

Adrian Sule
Hi, I'm a Romanian Flash Developer, based in the UK, and I probably have a bunch of articles in my head that need to be laid down in writing. Graduated a Bachelor Degree in Computer Science, and have been working within Digital Agencies for the last 4 years now, in the Creative team as a Flash Developer and sometimes Designer. http://www.adriansule.com
View all articles by Adrian SuleLet’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=”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)
Spread The Word
1 Response to "How to decrease a Flex application files size (FB 3 & FB 4 Gumbo)" 
|
said this on 12 Sep 2009 9:40:35 AM CST
Beware that creating modu
I Howev So |


Author/Admin)