开发者

Why 2.4 MB worth of data for a simple Flex App? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. 开发者_Go百科 Closed 11 years ago.

I have a Flex application here

If you open that link, you'll see it takes quite a long time to download (after the first bar is complete, the screen gets blank for a while and then the app is shown), even though it's only a simple Flex app with only one screen (albeit 2 states).

I opened this app with firebug turned on and I noticed that the reason why it's taking so long is because the browser is downloading 2.4 MB (!) worth of data just to show that app. The actual app .swf file is just 88 KB but a lot more is being downloaded as well.

Some extra .swf files (quite large) that are being downloaded as well are:

mx.swf,spark.swf, spark skins.swf,text-layout.swf and others... Each of those is about 300-400 KB in size!

I developed some things in Flex 3 in the past and it wasn't like that at all.

What am I missing here?

Thank you .

P.S.: I am using Flash Builder 4.5 for PHP.


You're right it does appear to take a long time to load. I'm not sure why without a formal code review.

I don't have an explicit answer for you. But, here are a few things to note:

1) With each SDK release, Adobe has been splitting the Flex Framework up into multiple; more encapsulated SWF files. The actual Flex Framework files can be distributed as SWZ files. These are Adobe compiled libraries that can be cached across multiple domains. In theory these files do not have to be downloaded each time the app loads; leading to even smaller file size. I believe you have to set the framework to load as an RSL to benefit from this, though. There should be settings for this within Flash Builder project properties.

2) It seems like you uploaded the bin-debug folder. Be sure to export a release build before moving into production. This will result in a small SWF file for you to distribute, which may help.

3) I expect the Flex Compiler to optimize the resulting SWF as to not include classes it does not need. I'm not sure how this relates to the extra SWFs being downloaded for your app. Are you using any MX Components? Are you using any components that use the text layout framework? (Some Flex text controls use it under the hood). If not; ideally those extra files (mx.swf and text-layout.swf) would not be downloaded if you're not using those files. So, you may be able to review code and optimize those out by using equivalents.

4) What does your app do on startup? Are you sure the issue here is that all these files are being loaded? Or is there something in the code that prevents a quick setup of your application?


The additional SWFs you listed contain libraries which are necessary for the application. They are called Runtime Shared Libraries (RSLs) (see the link for details).

The benefit of RSLs is they can be cached by browser and Flash Player and so 2.4 Mb are the size for the first time loading. Even more, the special form of RSLs, called SWZ, are signed libraries which can be cached by Flash Player directly across all the Flash applications. To optimize your RSLs see the following link.

Another way is to include required classes in your application via Project Settings in Flash Builder. The whole size will be less and it will be single SWF but it will be loaded all the time you compile and deploy new application version.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜