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.

Demo

Code

 


Follow

Get every new post delivered to your Inbox.