Components Flex


    
    
        
            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;
                }
            }