ToggleButtonBar demo
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" initialize="initApp(event)">
<mx:ToggleButtonBar id="toggle" dataProvider="{dataProvider}" itemClick="setMode(event)"/>
<mx:Script>
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
import mx.events.ItemClickEvent;
[Bindable]
private var dataProvider:ArrayCollection;
private function initApp(evt:FlexEvent):void {
var temp:Array = new Array({label:"Show Labels",mode:"labels"},
{label:"Show Titles",mode:"titles"});
dataProvider = new ArrayCollection(temp);
}
private function setMode(evt:ItemClickEvent):void {
switch (evt.item.mode) {
case "labels":
mx.controls.Alert.show("A");
break;
case "titles":
mx.controls.Alert.show("B");
break;
default:
break;
}
}
</mx:Script>
</mx:Application>
Related examples in the same category