Share on Google+Share on Google+

LinkBar Control in Flex4

Advertisement
The LinkBar control is a MX component. It has no Spark component. The LinkBar control sets to Link Buttons in a horizontal and vertical layout.

LinkBar control in Flex4:

The LinkBar control is a MX component. It has no Spark component. The LinkBar control sets to Link Buttons in a horizontal and vertical layout. You can use the viewStack as a child container. You can use the dataProvider property for providing a data to the control. You can also use the LinkBar control for a link to another URL, http request. You can use the addItem(), RemoveItem() method to manipulate the dataprovider property.
The tag of LinkBar control is <mx:LinkBar>.

Example:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx"

minWidth="955" minHeight="600">

<s:Panel title="LinkBar Control Example" width="430" height="121">

<mx:LinkBar borderStyle="solid" id="linkbar1"

itemClick="navigateToURL(new URLRequest('http://www.roseindia.net/' +

String(event.label).toLowerCase()), '_blank');"

x="15" y="20"

textDecoration="underline"

color="#413ebb" fontWeight="bold">

<mx:dataProvider>

<fx:Array>

<fx:Object label="FLEX" icon="@Embed(source='file:/C:/work/bikrant/flex4component/linkbar/icon-flex.jpg')" />

<fx:Object label="J2ME" icon="@Embed(source='file:/C:/work/bikrant/flex4component/linkbar/j2me-icon.jpg')" />

<fx:Object label="HIBERNATE" icon="@Embed(source='file:/C:/work/bikrant/flex4component/linkbar/Hibernate-Switch.gif')" />

<fx:Object label="MYSQL" icon="@Embed(source='file:/C:/work/bikrant/flex4component/linkbar/mysql.gif')" />

</fx:Array>

</mx:dataProvider>

</mx:LinkBar>

</s:Panel>

</s:Application>

In this example you can see how we can use a LinkBar control in Flex4.

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Advertisements

Posted on: May 24, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.