Search Flex Components Free

Custom Search

December 24, 2007

Flex Flow Control ButtonBar Source Code Example

This is a simple demo for the ButtonBar component. Click on the buttons in the ButtonBar below to align this text.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" backgroundAlpha="0" verticalGap="30">
<mx:Script>
import mx.events.ItemClickEvent;
private function clickHandler(index:int) : void { switch (index) { case 0: myText.setStyle("textAlign", "left"); break;
case 1: myText.setStyle("textAlign", "center"); break;
case 2: myText.setStyle("textAlign", "right"); break;
} }
</mx:Script>
<mx:Text id="myText" width="300"> <mx:text>This is a simple demo for the ButtonBar component. Click on the buttons in the ButtonBar below to align this text.</mx:text> </mx:Text>
<mx:ButtonBar id="buttonBar" itemClick="clickHandler(ItemClickEvent(event).index)"> <mx:dataProvider> <mx:String>Left</mx:String> <mx:String>Center</mx:String> <mx:String>Right</mx:String> </mx:dataProvider> </mx:ButtonBar>
</mx:Application>

Related Flex Tutorials