December 13, 2012

Hi All,

I have moved my blog from to

Sorry for any inconvenience, please update your links and such.

Hope to look forward to your support.

Image Cropping in Flex

January 31, 2011

Even though there are many posts on this particular topic still there are many ???, then i thought may be i can write about it, so lets get started.

Lets do things in steps.

  1. Load Image in to Flex App
  2. Convert it to Bitmap and BitmapData objects.
  3. Crop Image using BitmapData object

1.Load Image in to Flex App

private var imageLoader:Loader = new Loader();

private function fnInit():void
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadImageComplete);
imageLoader.load(new URLRequest(“assets/flower.png”));

2.Convert it to Bitmap and BitmapData objects

private var bitmapImage:Bitmap;
private var bitmapDataImage:BitmapData;

//Event.COMPLETE eventHandler for Loader

private function loadImageComplete(e:Event):void
bitmapImage = Bitmap(;
bitmapDataImage = Bitmap(bitmapImage).bitmapData.clone();

3.Crop Image using BitmapData object
Read the rest of this entry »

Tip on LinkBar control in Flex

December 20, 2010

LinkBar control defines the style name “linkButtonStyleName” to specify styles for link buttons, but does not define a style name for a selected link button.For example if you want to apply a specific style for a selected link button in the row of link buttons, you would think for a while, make some try outs, look in to the code, scratch your head for a while,curse flex and may be finnally give up.The real thing is it isn’t defined.But there is a way.

LinkBar control defines a row of LinkButtons, meaning we can access and apply styles to any of these individual Buttons at run time using setStyle method.

Example: Button(lnkBr.getChildAt(0)).setStyle(“fontWeight”,”normal”);

In the above line lnkBr is id of the LinkBar and getChildAt method gets that particular button and then we can apply style to that button using the setStyle method.




Display ToolTips for Combobox List items in Flex4

July 13, 2010

Few months back i made this post in Flex3, it was buggy and i figured later it may not be possible here with my logic.Then comes the Flex4, did anyone tell you Flex4 is awesome, yes it is.The same requirement where you want to show tooltips on comboBox List items on roolover can be achieved easily in Flex4.You may have to read about the new ItemRenderer Class and its architecture for better understanding the code and you can go figure your own requirement then.

Download code below.

Read the rest of this entry »

Flash,Steve Jobs,Adobe: what do you think?.

April 30, 2010

If you haven’t read it, please do so.

So after reading the longggggggg page, i just thought a few too.

1.Did he just pull a fast one?.
2.Why is he directly blaming Flash(Adobe)?, I smell something fishy.
3.What does the Microsoft think about this?,  The enemy of my enemy is my friend.
4.I find only two thoughts reasonable,
 -Third, there’s reliability, security and performance.
 -Fourth, there’s battery life.
5.Repetitive thought, we follow all open standards [HTML5, CSS and JavaScript ...], yeah like they create them and we should follow them.:-)
6.How come Flash works on Android phones?.May be Apple needs to enhance their products.
7.What’s Adobe reaction?.
8.There’s always thrist for new experiances, can’t stick to one standard/technology for a long time, and especially in this era whether PC or mobile.
9.Why did we adopt to Flash for web and Why is that difficult for mobile.Its been 40 years since man set foot on moon, did they make it or fake it.
10.It really doesn’t matter for the end user/customer who owns what, what really matters is that who can satisfy him/her.
11. And there’s a lot more …………………..

i am really tired of this shit, so if you people have any thoughts on this just comment.

Tip on Panel Class in Flex

December 16, 2009

Often hear questions on Alert Control like, remove default Button(OK),add new Button’s and so on.., and on TitleWindow like, re-arrange close Button to top-left,add new Buttons and so on..

One thing we got to notice at first is that TitleWindow and Alert are Classes which are derived from Panel Class, which in turn is derived from Container Class, so Alert and TitleWindow are sub-classes of Panel Class, they are created by addding new functionality[methods and properties] to the Panel Class.And the final tip is that, look in to the code,look in to the Class Diagram and if you dont have one then download it here , make a print and stick to a wall near you.

So, having said that you need to decide an appropriate implementation based of your requirements.Example, if you dont want to show OK(default Button) Button on the Alert Control,then better not to use Alert Control, go for a Panel,which is appropriate.

Below fig shows the Relational Diagram of Container,Panel,Alert and TitleWindow Classes.

Relational Diagram of Panel,Alert,TitleWindow

Enjoy the Post.

Sorting Date’s on ArrayCollection in Flex

November 16, 2009

First things first, read about the mx.collections.Sort Class before going in to the code below.

About the Post,suppose i have a AC[ArrayCollection] like below;

private var arrClldetails:ArrayCollection = new ArrayCollection([
{Fname:"Kranthi", Lname:"Kata", dob:"21 Sep 79"},
{Fname:"Vasanth", Lname:"Lola", dob:"11 Jun 80"},
{Fname:"Manoj", Lname:"Pati", dob:"16 July 81"},
{Fname:"John McClain", Lname:"Mela", dob:"15 Feb 72"},
{Fname:"Ross", Lname:"Geller", dob:"02 Jan 74"},
{Fname:"Chandler", Lname:"Bing", dob:"18 Oct 76"}

Now i want to Sort the “dob” Date field in the AC.,so for this i need to
write a compareFunction for Sort which in turn is applied to the AC like below,

Read the rest of this entry »

Tracing Childrens of a Container in Flex

November 9, 2009

A Container in Flex is one that controls the layout characteristics of child components and which extends the Container base Class like the famous Panel,Canvas,ViewStack,TabNavigator,…

Container contains childrens or Sub Components or Sub Containers[Container in a Container], and so on.Childrens/child components in a Container are all are created using the creationPolicy setting of that Container.In case of sub containers, outer Containers are created before the inner one’s.And creation can be altered by setting the creationPolicy.

So now we know some basics of Container its time for the Topic.

We can manage the child components of a Container by using its predefined methods,like below..
1.Container.getChildren() – returns an Array of child components.
var arr:Array=Container.getChildren();
2.Container.getChildAt(index:int) – returns an instance of the DisplayObject at that creation index,which we can cast to required.
var obj:Object=Container.getChildAt(0);
3.Container.removeChildAt(index:int) – removes child at that creation index
var disObj:DisplayObject=Container.removeChildAt(0);
4.Container.removeAllChildren() – as the name specifies
….so on

In the below download code i have implemented all these methods with a Panel.Enjoy the Post.

Download code.

Assign a menu item(on right click menu list) to DataGrid control in Flex.

October 9, 2009

OK, First thing to do, read about flash.ui.ContextMenu Class.
Some points..
->In SWF content, any object that inherits from InteractiveObject can be given a context menu by assigning a menu object to its contextMenu property.
->In Flex, only top-level components in the application can have context menus.
->Flash Player has three types of context menus:standard menu ,the edit menu and an error menu.Only the standard and edit menus can be modified with the ContextMenu class.

so first create a ContextMenu for the DataGrid like below..

private function fnDgContextMenu():ContextMenu
var newContextMenu:ContextMenu = new ContextMenu();
var newContextMenuItem:ContextMenuItem=new ContextMenuItem(“Sort”);
return newContextMenu;

now assign it to DataGrid.
dg.contextMenu=fnDgContextMenu(); // here dg is the “id” of the DataGrid.check the code below.


Download code.

Enjoy the post.

Tips on MenuBar control and its dataProvider in flex

September 25, 2009

Suppose we have a MenuBar and its dataPovider as below.

<mx:MenuBar id=”myMenu” dataProvider=”{xmlLst}” labelField=”@label” itemClick=”fnItemClick(event)” />

<mx:XMLList id=”xmlLst”>
        <root label=”year”>
            <menuitem label=”2001″ enabled=”true”/>
            <menuitem label=”2002″ enabled=”false”/>
            <menuitem label=”2003″ enabled=”true”/>
            <menuitem label=”2004″ enabled=”false”/>
            <menuitem label=”2005″ enabled=”true”/>

and the itemClick handler below
private function fnItemClick(event:MenuEvent):void
//code goes here on itemClick
Desc: The MenuBar displays the XMLList dataProvider with all the years as menuitems[because labelField="@label"], and has a handler for itemClick “fnItemClick”.

Now the tips..

1.To set enabled=true for the year 2002.
//this is like traversing the XMLList.
//this will reflect changes both to XMLList and MenuBar
2.To set for all enabled=true.
//here we got to traverse the XMLList and change the data.
for each(var xml:XML in xmlLst.menuitem)
3.To set enabled=false for selected Item.
//in the itemClick handler use the below code

Things to remember:- while accessing attributes of XML we got to use ‘@’ before the attribute name, not neccessary if it is an Object.

Download code.

Note:- Examples or code you have seen on this blog so far are related to Flex 3 SDK.

Custom Component: Indicator Label for download

August 19, 2009

As you all know that i made a custom component called Indicator Label from this post.Now its time for me to release the component, so follow this link and fill out the form and then i will send you the component through mail.I need this information only to keep track of my downloads, nothing less and nothing more.

Enjoy the component.

Adobe devsummit, i was there too.

August 10, 2009


On 4th Aug 09 i attended the Adobe devsummit at Bangalore.This was my first experience with huge crowd of Flex users.Few years back this wasn’t the situvation.If i recall,,,..if i ask someone “there’s Flex Meet you wanna go” then the  reply would be like “Flex??,what’s Flex?”. But a lot has changed now, Adobe Flex is clearly visible everywhere on the internet.There were around 1200 people at the event.And the event was good.There were sessions on FX4,CF,FXB4,FC,…, it was good, you could actually get a good picture on these technologies.Flash Builder 4 was cool with good set of features,Flex sdk4 again with new shapes,and a new product called Adobe Catalyst, this is really amazing product from Adobe.Everything was cool and hot.

Then I met few Adobe people, it was great talking to them,i shared my thoughts on Flex and they were quite interested in listening to me too.:-).And guess what, the lunch was great too, and it was very uncomfortable for me to sit there after a great meal like that, but i managed somehow.:-)

I was very much interested on one particular session “Flash on Mobile”, and there was good insight given on this topic.And i know this will be big in the future.

There were employees from top IT major like Infosys,Wipro,cognizant… who attended the event.I even talked to an employee from Infosys, he says the company has just began showing interest on Adobe Flex and has recruted a team on Flex.And there were students also at the event interested in this domain and a great number attended the event.They were very energitic and they love this platform.

I was spotted and recognized by few people, and they all thanked me for this blog and the effort i make on the blog.Well folks i love sharing my knowledge.

Finally good going Adobe.Time will only answer your calls.Enjoy the post.

Close the browser window from Flex App.

August 7, 2009

Using two lines of javascript code we can actually close the Browser window.But not all the Browser’s support this feature[works on IE], they only give limit access through javascript.But as the question is made here is the solution.

function closeme()

this is the js code.So how you gonna make this function call from the Flex App?.Simple use ExternalInterface.

Read the rest of this entry »

A Tip on Alert Control in Flex

July 24, 2009


How to disable selectivity on Alert control display message?


Alert control display message should not be selectable.


var“Cannot select this text!!!”);

Enjoy the post.

A Tip on Alert Control in Flex.

July 20, 2009


How to make the defaultButton on Alert Control invisible?


var a:Alert;
a =“where’s my defaultButton (OK)!”);
a.mx_internal::alertForm.mx_internal::defaultButton.visible = false;

Enjoy the Post.


Get every new post delivered to your Inbox.