ArrayCollection as dataProvider for TabBar : TabBar « Container « Flex






ArrayCollection as dataProvider for TabBar

ArrayCollection as dataProvider for TabBar
          

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.events.ItemClickEvent;
        import mx.controls.TabBar;
        import mx.collections.ArrayCollection;
        [Bindable]
        private var STATE_ARRAY:ArrayCollection = new ArrayCollection([
                                                    {label:"A", data:"AA"},
                                                    {label:"B", data:"BB"},
                                                    {label:"C", data:"CC"}
                                                  ]);
        private function clickEvt(event:ItemClickEvent):void {
            var targetComp:TabBar = TabBar(event.currentTarget);
            forClick.text="label is: " + event.label + " index is: " + event.index + " capital is: " +
            targetComp.dataProvider[event.index].data;
        }
      
    </mx:Script>
    <mx:TabBar id="myTB" itemClick="clickEvt(event);">
        <mx:dataProvider>{STATE_ARRAY}</mx:dataProvider>
    </mx:TabBar>
    <mx:TextArea id="forClick" width="150" />
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1. defines the text for each tab in the TabBar control.<mx:String> defines the text for each tab in the TabBar control.
2.Use labelField property of TabBar control to specify the property name containing the tab textUse labelField property of TabBar control to specify the property name containing the tab text
3.itemClick event for TabBaritemClick event for TabBar
4.Spark TabBarSpark TabBar
5.TabBar ObjectTabBar Object
6.TabBar LabelTabBar Label
7.Populate a TabBar control from a variablePopulate a TabBar control from a variable
8.A handler for the itemClick event for this TabBar controlA handler for the itemClick event for this TabBar control