在使用多个模块时优化Flex [英] Optimizing Flex when multiple modules are used

查看:151
本文介绍了在使用多个模块时优化Flex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Flex应用程序,其中加载时间非常重要(消费者站点)。我希望能够在屏幕上获得一些东西,然后允许额外的模块被加载。

我面临的问题是,所有的总和这个模块比我将所有组件包含在一个.swf文件中要大得多。



这很明显,为什么。例如,Web服务访问所需的类似乎需要大约100kb。如果我不在main.swf中使用这些类,那么它们将被包含在每个使用它们的模块中。所以,如果我有5个模块,这额外500kB浪费。



从理论上讲,我想要3个级别的主bb b
。 swf - 可能的最小布局/风格/字体/框架类型的东西
common.swf - 模块1所需的附加类+模块2(如Web服务)
module1.swf - 模块1在站点
module2.swf - 模块2在网站中



我不知道这是否可能。



I我想知道是否我可以加载swz / swf文件的部分框架,而不是整个框架。

我真的需要得到我的主要应用程序的大小下降到200Kb。它增长到450kb,当我添加Web服务和基本的数据网格功能。



任何经验教训将不胜感激。

解决方案

我知道这是一段时间以前,但我想我会张贴另一个反应,以防止任何人仍然在这个问题上寻找答案。



我一直在研究优化Flex应用程序,经过一番检查,决定使用模块。主要是因为他们有这样的优化选项。

您需要的两个mxmlc命令是:

  mxmlc -link-report = MyAppReport.xml MyApp.mxml 

  mxmlc -load-externs = MyAppReport.xml MyModule.mxml 

我的外部swf(使用Flex框架)现在只有21k。它还做得很多,但是即使它越来越多,它将继续使用主应用程序代码中的资源。

这是我创建的批处理文件控制面板 - >系统 - >高级 - >环境变量,编辑路径系统变量,添加路径到你的mxmlc(需要):

$ cd $ cd $ C $ \\Projects\MyProject\Develop\Modules
mxmlc - link-report = MyAppReport.xml C:\Projects\MyProject\Develop\Source\Main.mxml
mxmlc -load-externs = MyAppReport.xml MyModule.mxml
move / Y MyModule .swf ..\Runtime\Modules

更多信息:
http://livedocs.adobe.com/flex/3/html /help.html?content=modular_4.html



希望在帮助!


I have a Flex application where load time is extremely important (consumer site). i want to be able to get something up on screen and then allow additional modules to be loaded as necessary.

The issue I'm facing is that the sum total of all the modules is much larger than if i were to include all the components in a single .swf file.

Its pretty obvious why. For instance the classes needed for web service access seem to take about 100kb. If I dont use those classes in my main.swf then they'll be included in EVERY module that uses them. So if I have 5 modules thats an extra 500kB wasted.

In theory I want 3 levels

main.swf - minimum possible layout / style / font / framework type stuff common.swf - additional classes needed by module 1 + module 2 (such as web services) module1.swf - module 1 in site module2.swf - module 2 in site

I dont know if this is even possible.

I'm wondering if I can load swz/swf files for portions of the framework instead of the entire framework.

I really need to get my main app size down to 200Kb. It grows to 450kb when I add web services and basic datagrid functionality.

Any lessons learned would be appreciated.

解决方案

I know this was awhile ago, but I figured I'd post another response in case anyone is still looking for an answer on this.

I've been looking into optimizing Flex apps and, after some checking into it, have decided to use Modules. Primarily 'cause they have such good options for optimization.

The two mxmlc commands you need are:

mxmlc -link-report=MyAppReport.xml MyApp.mxml

and

mxmlc -load-externs=MyAppReport.xml MyModule.mxml

My external swf (using the Flex Framework) is now only 21k. It's doing much (yet), but even as it does more and more, it will continue to use resources from the main app code.

Here's the batch file I created to speed up the process (you have to have put mxmlc in your Environment Path variable for it to work like this. Control Panel -> System -> Advanced -> Environment Variables, Edit the Path System Variable, adding the path to your mxmlc (requires a reboot)):

cd C:\Projects\MyProject\Develop\Modules
mxmlc -link-report=MyAppReport.xml C:\Projects\MyProject\Develop\Source\Main.mxml
mxmlc -load-externs=MyAppReport.xml MyModule.mxml
move /Y MyModule.swf ..\Runtime\Modules

More info here: http://livedocs.adobe.com/flex/3/html/help.html?content=modular_4.html

Hope that helps!

这篇关于在使用多个模块时优化Flex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆