Our application is a bit slow to load at startup, i'm wandering myself if a sepation of the module of the application in several swc will decrease the loading time( grosso modo : a module = a "page" )
问题:
回答1:
SWC is simply a compressed zip-like archive of classes (static library)/ Compiling an application against SWC doesn't change the outputted swf. There are 2 means by which you can decrease the initial loading:
1.RSL - dynamic library which are loaded separately from the application and can be cached. Any RSL signed by Adobe can be cached not just by the web browser which is platform-dependent caching, but also by the flash player itself, which means that even if a user clean its browser cached or has no cache at all, once the RSL is downloaded, it's cached.
This is typically useful for runtime loading of the flex framework & the RPC. The other type of RSL caching like said earlier is browser caching. Either way, RSL is loaded at startup.
2.The other way is by extracting parts of the application into modules, which will be loaded by demand. For example, if the application has 3 screen, each screen will probably be loaded ["probably", because it's up the developer to decide when] only when the user first enters this screen
回答2:
It depends on what is making startup slow. Is it slow after the SWF has been cached by the browser? If so then you need to just better structure your code so that not so much is happening on startup. You can defer creation of object by setting the creationPolicy property on components. If the slowness is being caused by the size of the SWFs then using the framework RSLs and partitioning into Modules will help reduce the initial download size.