Flex app weighs 500kb? Easy fix!
This article focuses on how to reduce the size of a Flex application without using any magic.
Specifically, what RSL is and what it does.
Well, a couple of words about nailing with boeing.
')
To begin with, once again we will define the concepts of Flex SDK and Flex applications.
Flex SDK / Flex Builder / Flex application
The Flex SDK is an open-source framework written in ActionScript 3 to create rich Internet applications.
Link:
http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDKFlex Builder is an IDE for developing ActionScript 3 that is in close contact with the Flex SDK.
Links:
Win / Mac:
http://www.adobe.com/products/flex/Linux:
http://labs.adobe.com/technologies/flex/flexbuilder_linux/Flex application - an application using the Flex SDK.
Examples of Flex applications can be viewed on the same
flex.orgHow much does an empty Flex application weigh
Having created an empty Flex application, you can be surprised to notice that in the publish version it weighs about 176 kilobytes.
This is due to the fact that the Flex application includes part of the Flex SDK.
<lyrical retreat>
By the way, which classes were included in the swf during compilation and how much they weigh can be viewed in the size report. For this, it is enough to add "-link-report size.xml" to the compilation properties. For example, like this:

And the size.xml file will appear in the bin-debug folder. The view is weak, but with the same excel it can be processed and viewed.
This option can also be set for non-Flex applications.
</ lyrical retreat>
Reduce the size by untiing the framework
First the result:After quite simple actions, the application will weigh ...
70 kilobytes.(do not be in a hurry to rejoice very strongly and read to the end)
These 70 kilobytes will include only a small part of the Flex SDK that is loading the framework * + your code.
(* - version)
And this size will not depend on which Flex components you use, and which not.
How to do it:
It is very easy to do this - in the project properties we set the Framework linkage - Runtime shared library (RSL). Do not forget to leave a tick "Verify RSL digest".

The framework linkage specifies how the framework will be used — either it will be “embedded” in the swf, or it will live separately.
Verify RSL digests gives a bun in the form of crossdomain.
“But after all, some other framework will still be loaded”
Here is the most interesting. This file contains the lion's share of the Flex SDK. And it will boot only once. C any domain.
That is, if the spherical Vasya Pupkin opens the Flex application on the site.smth site and uses RSL decoupling of the framework in this application, then this version of the framework will be cached by him.
And if he opens some other Flex application on another site that uses the same version of the framework via RSL, the Flex SDK will not load.
Details on RSL in the help:
http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_09.htmlA spoon of tar
To the user, if he opens a Flex application using for example the Flex SDK version 3.2.0.3958 via RSL for the first time, he will still have to wait for the download.
And long enough. The size of the signed sdk is about 550 kilobytes.
Common sense
Do not use the Flex SDK where it is not needed.
Or you do a rich Internet application, or utility to upload files to the site. If you use the Flex SDK for the second case, this is nailing with Boeing.