开发者

How to optimize modular flash apps (load time & flexibility)?

I'm working on a large application that is broken up into many independent swfs. There is a master swf that loads a navigation shell and the foundational logic, and a module loading system that loads child swfs into the main display area. This is all working smoothly, and now I'm onto building the modules, and I'm starting to feel like my methods aren't as efficient as they should be.

The module swfs (and corresponding flas) are located in a "modules" subdirectory of the main project's src folder. These modules share a large number of classes. In fact, most them define no new classes that are specific to just that module. The shared classes have a complicated structure of inheritance and interface u开发者_Python百科sage, and are located in a view/structure subdirectory of the main src folder.

Currently, in order to use the shared classes from view/structure in my module swfs, I add the main project's src folder to the source path in each of the module flas. Besides being a bit tedious to do every time, it 1.) Redundantly compiles the shared classes into each module increasing file sizes across the board, 2.) Requires addition of new source paths to the modules for every developer who wants to work on/test the application because they are absolute values and different on every os's file system, and 3.) Doesn't allow modules to be built independently without access to the main project src folder

I did a bit of research on RSLs in flash, but I couldn't quite see how I would fit them into this scheme.

Any ideas? Many thanks for reading.

-Dane


In this case I highly recommend to use runtime shared libraries. I've never done it from Flash IDE directly since I always compile via Flex, however I guess it should be almost the same logic from Flash IDE, but you may have to tweak the following solution a little bit though as I'm writing it from the top of my mind without ever having tested it ...

Include all the main classes to be shared within the main shell by referencing them somehow in its code (the compiler includes classes the lazy way and the non referenced classes will not get included and exported).

To ensure the consistency of the shared classes, publish an SWC of the used classes (tick 'Export SWC' in publish settings). You can always double check the SWC's content simply by unzipping it.

Within your loaded modules remove the class paths from the "Source Path" / "Library Path". Instead, add the SWC freshly created to the "External Library Path" listing. When you now export your modules the classes found in the SWC will not get included in the SWF's.

Note : You may probably get runtime errors ("definition not found ...") when you export/run the modules externally from the main SWF. This makes sense since the definitions you stripped out are meant to come from the main SWF.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜