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

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

warning: unable to bind to property ‘asset’ on class ‘Object’

When you use the dataprovider as Arrays or ArrayCollections which contains server data to populate controls like Datagrid, Tilelist..with itemrenderers and while debugging, you might be familiar with this screen below:


Now why this is warning occurs ? because the Object Class  inside the Array and ArrayCollection doesn’t implements IEventDispatcher and it doesnot allow it to be treated as a bindable property. Since removing warning from the application that you develop is essential for the increasing performance of the application, the solution to this should be the following:

// consider myArrayCollection has the server data
var myArray:Array = new Array();
for(var i:Object in myArrayCollection)
myArray[i] = new ObjectProxy(myArrayCollection[i]);
targetArrayCollection = new ArrayCollection(myArray);

Here the objects are taken out and wrapped by the ObjectProxy which will enable the binding properties and you will be free from warnings. 🙂
Other solutions that can also be proposed to solve these warning. One of them would be make bindable variables inside the itemrenderer and pass the values of properties from data to the variables and then bind the variables to the controls. Warning free application certainly does give a performance boost even though performance depends on several other factors. 😉

Alter the properties of the SWF

Did you know that we can alter the properties of the output SWF of Flex.
The can be done like this:
In a Flex project the application class:

[SWF(width=”500″, height=”500″, frameRate=”30″, backgroundColor=”#FFFFFF”)]

and in an actionscript project , the code should be like this:
   [SWF(width=”500″, height=”500″, frameRate=”30″, backgroundColor=”#FFFFFF”)]
   public class MyClass


I found it handy inorder to fix a problem I encountered in one of our projects. This might not be used quite often, but it is worth knowing…. 🙂

“Hello world”

Starting off with “Hello World”  like when we start working on something. Finally, I am able to setup a blog which was on the cards for the last one year. Phew!! it is not at all a hard task . but the simple excuse would be the lack of time. I would be blogging about the technical aspects/my experience on Adobe Flex and other technologies. Will try to post something or the other on a regular basis. Hope the post might prove helpful for the readers.