RSL used in FLEX - apache-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.

Related

Automatically run maven on save in MyEclipse, without committing project files

This may be a problem that others have had before, but I've not been able to find the right search terms if so.
I am using LESS CSS (a CSS pre-processor) in my webapp, and I need it automatically compile a CSS file whenever a LESS file is saved, such that I can just refresh my browser and see the changes. I have previously been successful in doing this by changing the project properties in MyEclipse, in order to point at an external maven executable, and the generate-sources phase within my project's POM.
We're now in the progress of transitioning to GIT (very slowly), and as a step on that path, we want to ensure none of the project files are in version control. Obviously this means that setting up an external executable in the project files is no longer viable, if I want all developers to automatically have this happen for them.
Can anyone please point me in the right direction for solving my problem?
You could try the web resource optimizer for java (aka wro4j). It can apply less css processor (or many other processors) using both: runtime solution (as a filter) or build-time solution (as a maven plugin with m2-wro4j eclipse plugin which is capable of identifying incremental builds).
Alternatively, there is a lightweight solution which process the less resources on the fly, using the LessCssFilter

Compiling with Flex4 SDK

I'm trying to compile an existing Flex3 project with the Flex4 SDK. I'm getting this error:
Warning: This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option.
The resulting file is roughly the same as my old Flex3 compiled .swf file. Playing the resulting .swf file in the Flash Player also gives the following errors:
An Actionscript error ocurred: VerifyError: Error #1014: Class spark.core::SpriteVisualElement could not be found
If I set the compiler attribute static-link-runtime-shared-libraries to true, then the error disappears and all is well. However, the size of the resulting .SWF is a couple of 100K's bigger. And that's not what I want.
I don't fully understand the concept of runtime shared libraries, but it seems that with the option to statically link them set to true, the libraries are included in the .swf. However, I like to exclude them from the .swf and only load the needed library at runtime, as my project seemed to do with Flex3 (I didn't know that by the way).
If I understand correctly, playerglobal.swc should hold all the necessary code for the external libraries that my .swf has to load. Do Flex4 compiled files need more libraries? Should I do something with the factoryClass in the Frame metadata tag?
I think my question boils down to this: How do I compile a Flex4 .swf that is the same size as my previous Flex3 compiled .swf?
You have to add [Frame(factoryClass="path.to.your.preloader")] to the main class (the one you set in the compiler options).
Flex3 did not use rsls by default but you could enable them. Flex4 rsls are enabled by default, see: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7add.html
The concept of runtime shared libraries is: splitting of a part of your application that is (re)used by other apps as well, thereby only requiring the user to download it once. This won't save anything on the first download but will save on later downloads. You could possibly make your own rsl, but it's mostly the ones provided by adobe that are meant to make the difference: Since 'everybody' will use them there will be a bit chance the library you need is already present on the user's system, thereby speeding up the download-time of your app.
playerglobal.swc never contained any flex framework classes, most of them are in flex.swc and framework.swc (a standard flex 3 project also includes rpc.swc and utilities.swc - I didn't check but these probably contain some flex parts as well)
Looks like you might have project migration problems. You might want to read up on the process on:
http://www.adobe.com/devnet/flex/articles/flexbuilder3_to_flashbuilder4.html
It's a really good article with overview of different possibilities for migration, depending on the amount of Flex4 stuff you want to use.

Flex RSL Understanding

Till now I was using "Merged into code" for "Framework Linkage" in
Flex Builder. Now, I changed it to "Runtime shared library". On doing
a release build I got myapp.swf which is roughly 260 KB which was earlier
close to 350 KB. It also generated framework.swz and framework.swf.
But I copied only myapp.swf on my web site and not framework.swz.
Still the website works just fine. I also cleared the flash player cache
from here. It works just fine without the .swz file. So my questions are:
Is the framework.swz file actually used or does the flash player have
a copy of it beforehand. And is that copy not cleared by clearing cache of
flash player?
And, even after clearing the cache, I didn't see a request for framework.swz
in firebug. Why?
The framework.swz RSL is stored in a special Flash Player cache. It works cross-domain. You will definitely need the framework.swz file there for those that don't yet have the RSL in their cache. On Linux the cache is at: .adobe/Flash_Player/AssetCache
Also, if you are not already doing so, make sure you do a Export Release Build for your production app. That will reduce the size further.

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

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.

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