RSLs in Flex

There are several ways in which we can optimize the size of an application and to ideally increase the performance but using RSL does make a substantial change in the size of the SWF file. It makes the shared assets into a standalone file that can be downloaded and cached seperately on the client side.There are different types of RSL that are supported in Flex.
Why do we use RSLs ?
We can check this by creating a new flex project in flex builder, we will have an approx of 250KB of SWF file size and when we have RSL enabled the SWF file size is reduced considerably to 99KB which gives a clear indication on scale to which a flex application can be optimized.
How you can do it?
In Adobe Flex 3 the RSL is not enabled by default and everytime you compile your application everything including the framework  gets compiled into the SWF file that comes as the output of your app.
Now enable RSLs from the Library Path in the properties of your project.

2009-07-31_200331

Now we can go into the details what all happens.
Since we are considering this simple flex application we will only go through Framework RSLs in this post.After the above settings you build your application and you will find the bin folder has 2 more extra files generated from compilation – framework_3.3.0.4852.swf and framework_3.3.0.4852.swz

bin
These are framework RSLs which is externalized from your main application SWF and this results in considerable weight loss of the main SWF file. The framework RSLs consists of the pre-compiled libraries of Flex components and class libraries. These RSLs comes in two version – Signed (framework_3.3.0.4852.swz)  and Unsigned (framework_3.3.0.4852.swf) Framework RSLs. Signed RSLs are cached in player cache whereas the unsigned ones are cached in the browser. Similarly along with flex framework  the rpc and datavisualiztion components are also included in the Framework RSLs.

Since this is huge topic to be completed in one single post, I will again elaborate on this segment in my coming posts. So stay tuned… 🙂

My Talk on Flex in Ahmedabad

I should apologize first for blogging about the event after it is over. I was unable to do so since it was a decision made on very short notice and also I was not in the best of my health.
It was a free flex seminar which was organised by Gateway Education and Training| (Only Authorized Training Centre of CDAC-ACTS, in Gujarat) on 25th July,targetting audiences who are from different technical backgrounds and to make them aware of the basics of Adobe Flex, its advantages and it position in market.I was the only speaker in the event and I believe this was first ever event held in Ahmedabad for dicussion on Adobe Flex. Even though we had a registration of 35-40 people, only around 20 could make it to the event since the weather conditions were not favorable for travelling from long distances. The people who attended were from different backgrounds, some from .Net, from Java, some from Flash.. but everyone was very attentive and interactive.One  snap 🙂

Picture 001

The audience were very curious to know about the technology and also if Flex application would fit in with the existing technology, they work on and much more queries which I thought was definitely a positive sign. I am really looking forward to take more initiative to organise such events in Ahmedabad since this place has potential. Keep rockin Ahmedabad  😉
I also promise, from next time I will be posting about such events well in advance on my blog…

Ahmedabad FUG will also be on Twitter from now

Since twitter is the platform where people interact more nowadays, even Adobe Group is on Twitter. I also thought it would be great idea if Ahmedabad FUG will be on twitter and I have done exactly that , we are on twitter now http://twitter.com/ahmedabadfug . Hope people will start following :).. Cheers

Text Layout and Media Frameworks are now open sourced

Yes, the much discussed about TextLayout and Media frameworks is on Adobe Open Source now http://opensource.adobe.com/wiki/display/tlf/Text+Layout+Framework 
http://opensource.adobe.com/wiki/display/osmf/Open+Source+Media+Framework
I am really delighted to see the TextLayout framework which is intended to reduce the complexities with the usage of text that we have now.It has several rich features which will enable the usage of text in Rich Internet Applications like never before and it is also included in Flex 4.. Gr8 🙂 . One of the features that I found interesting is the ability to use text in bi direction, vertical text and also there are 30 writing scripts in different languages including Hindi, Tamil, Malayalam….
This demo from Adobe should give you a better understanding of the power of the new text engine that is built on Flash player 10.I am yet to look into the Media framework which provides features that will enable developers to create a unique playback experience….

AS 2.0 to AS 3.0

Our team is working on some really exciting projects nowadays and in one of them we have to migrate existing AS 2.0 codebase into AS 3.0 in order to improve the performance of the application. This process is quite handful of a job, but it is a great learning experience. This work can only be ideally carried out by a developer who is well aware of AS2.0 and AS3.0. Now, how difficult can it be for a person who has worked AS3.0 to understand on previous versions of Actionscript. I think it’s a bit hard for people who don’t have experience in working with Flash AS2.0.

There might be AS2 to AS3 convertor available in the market but most of them can only manage to change the syntax. This may help saving time in syntax changes but I won’t recommend that since the developer will not go through the code and will not be able to properly understand the code and moving forward he will find it difficult to work on it
Check out the links below which I think provides some informations:
http://www.mandalatv.net/fcny/
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/migration.html
I am open to suggestion from you to know how will you guys go about doing this 🙂

mx.controls.textClasses.TextRange

Are you thinking what this class does… ?
Well, in one of our project we had to develop a feature where we have a text area with text which has varying fontStyles, fontSize and fontWeight. Now the interesting part is to get these font styles on selection of a particular range of text from the Text control. I accidently stumbled upon TextRange class which proved to be a solution to my problem…..Just to test it I registered the mouseUp event on the text control and made the selectable property to true. As soon as I finish selecting a text, mouseup event handler should be called and in this handler function I wrote:

// txt is the id of the text control
var mySelectedTextRange:TextRange = new TextRange(txt, true);
trace(mySelectedTextRange.text);
trace(mySelectedTextRange.fontFamily);

So, by writing this I would be able to get the selected text as well as the fontfamily of the selected text in the Flex Builder console.
TextRange will take the following parameters – TextRange(owner:UIComponent, modifiesSelection:Boolean = false, beginIndex:int = -1, endIndex:int = -1).