Get selected value, state, capital and index : ComboBox Selection « Components « Flex






Get selected value, state, capital and index

Get selected value, state, capital and index
    
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import flash.events.Event;
        import mx.events.DropdownEvent;
        private function dropEvt(event:DropdownEvent):void {
            forChange.text+=event.type + "\n";
        }
        private function changeEvt(event):void {
            forChange.text=event.currentTarget.selectedItem.state + " " + event.currentTarget.selectedItem.capital + " " + event.currenttarget.selectedIndex;
        }
      
    </mx:Script>

    <mx:ComboBox open="dropEvt(event)" close="dropEvt(event)"
        change="changeEvt(event)" labelField="state">
        <mx:ArrayCollection>
            <mx:Object state="A" capital="AA" />
            <mx:Object state="B" capital="BB" />
            <mx:Object state="C" capital="CC" />
        </mx:ArrayCollection>
    </mx:ComboBox>
    <mx:TextArea id="forChange" width="150" height="100%" />
</mx:Application>

   
    
    
    
  








Related examples in the same category

1.Count item count for ComboBox selected itemCount item count for ComboBox selected item
2.Get selected item from ComboBoxGet selected item from ComboBox
3.ComboBox Selected IndexComboBox Selected Index
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.