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.