ButtonBar click changed event : ButtonBar « Components « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Components » ButtonBarScreenshots 
ButtonBar click changed event
ButtonBar click changed event
       

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:s="library://ns.adobe.com/flex/spark">
    <mx:Script>
        
            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.newIndexas Object;
                switch(selectedItem.mode){
                    case "labels":
                        Alert.show('A');
                        break;
                    case "titles":
                        Alert.show('B');
                        break;
                    default:
                        break;
                }
            }
      
    </mx:Script>
    
    <s:ButtonBar id="btnBar"
                 dataProvider="{btnBarData}"
                 change="btnBar_changeHandler(event)"/>
    
</mx:Application>

   
    
    
    
    
    
    
  
Related examples in the same category
1.Use ButtonBar with Use ButtonBar with <mx:ButtonBar>
2.ButtonBar and an event listener for the itemClick eventButtonBar and an event listener for the itemClick event
3.A ButtonBar control automatically adds or removes children based on changes to the dataProvider propertyA ButtonBar control automatically adds or removes children based on changes to the dataProvider property
4.Spark ButtonBarSpark ButtonBar
5.ButtonBar defines an event listener for the change eventButtonBar defines an event listener for the change event
6.Adding style to ButtonBarAdding style to ButtonBar
7.Create a Spark ButtonBar control to navigate the ViewStack containerCreate a Spark ButtonBar control to navigate the ViewStack container
8.Creating an MX ButtonBar controlCreating an MX ButtonBar control
w_ww__.___ja_v_a___2__s_._c_o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.