开发者

Min. Flex Module size is ~30kb and contains Framework classes. How to remove them?

Compile the following module with all framework SWC-s excluded in release mode in Flex 4:

<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" 
 xmlns:s="library://ns.adobe.com/flex/spark" 
 xmlns:mx="library://ns.adobe.com/flex/mx"/>

The SWF size will be 35,658 bytes.

Now generate link report via -link-re开发者_运维问答port for this SWF and load it via -load-externs. Size of the SWF now is 33.174 bytes.

If you check link report now, you will see that some framework classes like mx.modules:IModuleInfo or mx.utils:LoaderUtil are still there.

How to exclude them from SWF?


You are excluding framework SWCs by using RSLs, right?

If I had to guess, those classes are required by Modules and there is a reason for compiling them into the class. I'm sure Adobe was meticulous when creating RSLs and put a lot of thought into what should or should not be included in the main SWF.

I wonder why this is important, though. A 30K swf is really small.


The problem is that the standard components are not in the client runtime enviroment.

For example, in Flash with AS2 or AS3 if you use a ComboBox you have more than 20KB of overhead because the binaries for the component must be packed with your swf. This happend with Flex too. To make an small binary I used an small footprint library with the flash components, but this was for Flash AS2.

Good Luck.


I guess you have to dig through the link report. Find out which classes depend on mx.modules:IModuleInfo and mx.utils:LoaderUtil, and you're likely to understand how or why this happens.

It must be quite many classes, because the once mentioned including their dependencies have 6 KB raw and 2.8 KB optimized size.

greetz
back2dos

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜