Hello……….
A button Bar is a convenient way to place your buttons in an application. It saves a lots of space in your application interface.
Take a look at the following example which shows how to use the ButtonBar. An itemClickEvent is attached to each button in the ButtonBar.
You can place as many buttons inside a button Bar.
Copy the following code to your MXML file and you are done…….
Happy Coding………..
<?xml version="1.0"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" > <mx:Script> <![CDATA[ import mx.events.ItemClickEvent; private function clickHandler(event:ItemClickEvent):void { myTA.text="Selected button index: " + String(event.index) + "n" + "Selected button label: " + event.label; } ]]> </mx:Script> <mx:ToggleButtonBar borderStyle="solid" horizontalGap="5" itemClick="clickHandler(event);" toggleOnClick="true" selectedIndex="-1"> <mx:dataProvider> <mx:String>Button1</mx:String> <mx:String>Button2</mx:String> <mx:String>Button3</mx:String> <mx:String>Button4</mx:String> </mx:dataProvider> </mx:ToggleButtonBar> <mx:TextArea id="myTA" width="250" height="100"/> </mx:WindowedApplication>
Please leave your comments on this post.