import mx.collections.ArrayCollection;
import spark.events.IndexChangeEvent;
import mx.controls.Alert;
[Bindable]
protected var btnBarData:ArrayCollection = new ArrayCollection(
[
{label: 'Show Labels', mode: 'labels'},
{label: 'Show Titles', mode: 'titles'}
]
);
protected function btnBar_changeHandler(event:IndexChangeEvent):void{
var selectedItem:Object = btnBarData.getItemAt(event.newIndex) as Object;
switch(selectedItem.mode){
case "labels":
Alert.show('A');
break;
case "titles":
Alert.show('B');
break;
default:
break;
}
}
dataProvider="{btnBarData}"
change="btnBar_changeHandler(event)"/>