Monday, December 14, 2009

Runtime Shared Libraries

What is RSL:

One of the main problems with Flex is that the swf file size of the applications sometimes becomes a lot heavy resulting in an increased loading time. True that one the app is loaded in the browser, it provides faster access the next time, but the basic problem there is that it is loaded up in the browser. That means that it is easy to loose the cached content when the user deletes his browser cache (which happens way too often these days).
To counter this what can be done is that the shared assets and stand-alone files can be separately downloaded and cached on the client. These libraries are stored not on the browser cache but the Flash Player cache, and hence is never deleted. The creation of RSLs also greatly reduce the application SWF FIle
The basic use of RSL can be to separate out the Framework Libraries. More information here




Wednesday, December 9, 2009

Setting a background fill color in a Sprite

While extending components, it might be useful to set the background color to something. The Sprite in Flex does not provide a backgroundColor property as do UIComponents. But the background can be set just as easily using the "opaqueBackground" property.

All you need to do is:

mySprite.opaqueBackground = my_color;

* my_color can be a uint or a hex color String.



Setting Hand Cursor in Label

Lot of people have asked me this one question. While the answer is relatively simple, I have not found it mentioned at a lot of places. So here goes,

How to set a hand cursor in a label?

There are 3 properties put together that do this (Most places might tell you only 2).
1. useHandCursor = true;
2. buttonMode = true;
3. mouseChildren = false;

And lo and behold. All done.