ComboBox Selected Index : ComboBox Selection « Components « Flex






ComboBox Selected Index

ComboBox Selected Index
       
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
  
  <mx:Script>
    
      import mx.controls.Alert;
      private function changeHandler(event:Event):void
      {
        if (categoryList.selectedIndex == 0)
        {
          Alert.show("You selected all categories", "Everything!");
        }
        else
        {
          Alert.show("You selected " + categoryList.selectedItem, "One Thing!");
        }
      } 
  
  </mx:Script>
  
  <mx:ComboBox id="categoryList" change="changeHandler(event)">
    <mx:dataProvider>
      <mx:String>All Categories</mx:String>
      <mx:String>A</mx:String>
      <mx:String>B</mx:String>
      <mx:String>C</mx:String>
      <mx:String>D</mx:String>
    </mx:dataProvider>
  </mx:ComboBox>
  
</mx:Application>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Get selected value, state, capital and indexGet selected value, state, capital and index
2.Count item count for ComboBox selected itemCount item count for ComboBox selected item
3.Get selected item from ComboBoxGet selected item from ComboBox
4.Count the number of items in a collection between the selected item in a ComboBox control and the end of the collection, and then returns the cursor to the initial locationCount the number of items in a collection between the selected item in a ComboBox control and the end of the collection, and then returns the cursor to the initial location
5.Select a new locale from the ComboBox control.
6.Load a resource module when the user selects the locale from the ComboBox control.