Is building separate .swc allow a faster loading of the application? - apache-flex

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" )

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

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.

Related

Update Embedded Resource at runtime

In my ASP.NET MVC application, I want to update the contents of a css or js file which is embedded inside my dll at runtime, without restarting the application.
My application takes a long time to restart, so in development I'd rather not wait for minutes at a time to see changes in js or css.
I think Embedded resources are not meant to be changed in the runtime at all. It is almost same as you cannot modify the bytes (compiled from your source code) within your assembly at runtime. You may consider a different architecture for your Application so that you won't need to update your embedded resource at runtime. Especially for JS and CSS, they can be added in the runtime and they can be served by your server without any need to be embedded.
Anyway, I understand that you may have the need to embed the resource and so, here is the link I found, maybe useful for you: Programmically embed resources in a .NET assembly

Flex RSL Vs Modules

I am in the confusion advantages or uses of RSL and Modules.
It is said that RSLs will be cached in the browser, so that they can be used across multiple applications without loading the same library again.
My question is,
Since the Modules also published as swf only and Willthey also will get cached as like any other application (swf) ?
What is the special logic used in the RSL will get cache?
How does the cache logic differs for RSL than Modules?
thanks,
Mani
There are two kinds of RSL's: signed (by Adobe) and unsigned (like you and I would make)
The signed RSL's contain the Flex framework classes, and are actually cached by the Flash Player itself. You can reduce the size of your application by using these RSL's (the default in Flex 4).
You can compile your own code into unsigned RSL's or Flex Modules. Both of these are cached by the browser, as usual.
Module SWF's can be loaded by an application at anytime, RSL's are loaded up front at application startup.
Theres a definite advantage to using the Flex framework RSL's, but for your own code Modules might have an advantage b/c they don't force the code to be loaded at app startup time.

RSL used in FLEX

How to use RSL(Runtime shared library) in flex ?
how can decrease loading time of swf using rsl?
please give answer
The SDK default setting of the project is RSL.
check here Goto Project->Properties choose the Library path from the tab where you can see the framework linkage.
The thing is It is one of the way to reduce the size of the application and the library files are downloaded and saved to cache file in browsers. so when you run the application again, the library files are taken from the browser cache.so the loading makes faster than the first time.It continues until the cache is cleared from the browser. for more information refer here.

Using RSLs with Modules

We are building a fairly complex application that we need to be able to release different parts of at different times. To help us solve this problem we are using RSLs and Modules.
so let me describe the projects (names have been changed to protect the innocent)
core (rsl)
client (application)
groceries (module)
groceriesCore (rsl)
bakery (module)
bakeryCore (rsl)
We have one application client that loads the areas of the application as modules. We have a core RSL that does things like login and holds entitlements and provides an API for the modules to access this sort of state and also to communicate with each other.
When we load client we only want the core rsl to be loaded as that is that is currently required. When the groceries module is loaded we want the groceries rsl to load and likewise when the bakery module is loaded we want the bakeryCore rsl to load.
In reality this isn't what happens. If we set the projects up like that at run time the core rsl loads at application startup but the module RSLs do not load when the module is loaded. If we run an application from the project that houses the groceries module then he rsl loads when the application loads but not when the module does.
We need a way of loading the rsl when the module loads.
At the moment we specify groceriesCore and bakeryCore in the client application so they all load when the client loads. This is obviously not a good idea as when we add another 30 departments we don't want all these departments being downloaded at application startup - we only want them to be downloaded when they are required - when the application loads.
How do I achieve this? (other than a horrible custom rsl loader type thing).
RSLs can only be loaded at application startup. What I've done in the past is to make things like your groceriesCore another module instead of an RSL. Then you just specify it somewhere as a dependency for the groceries module so that when you want to load groceries it will check if the groceriesCore module is loaded and if needed, load it.
Managing the dependencies of modules is not something that Flex manages for you. So you will have to do it manually. Or perhaps the Potomac Framework will help with it's OSGI-ish approach.

How to get a Flex project to load a plugin at runtime?

I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loading a plugin at runtime? Ideally I'd like to be able to load a plugin from a URL, then execute some code from within the plugin (e.g. add a control to the page).
You can use either Modules or RSL.
RSLs have the advantage of getting cached by flash rather than the browser so they stick around longer.
Modules are easier to create and use. I have used modules and had issues with modules failing to load (code needs to handle that case). I haven't tried RSLs yet.
Here is some documentation on creating RSLs http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:Flex_3_RSLs
Note that, currently, loaded RSLs must be compiled against the very same version of the Flex framework.. if you plan for a "binary" plugin system, probably you want to wait for the Marshall plan feature to be implemented, in the next Flex version.
If you want to try a new and alternative approach, this is a application core framework modelled after java OSGi: http://www.potomacframework.org/
I haven't tried it myself, but it looks really cool!

Resources