ComboBox change event : ComboBox Event « Components « Flex






ComboBox change event

ComboBox change event
       

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initHandler();">
      <mx:Script>
        
            private var myString:String;
            private var myStringArray:Array = ["A", "B", "C"];

            private function initHandler():void
            {
                fruitCB.dataProvider = myStringArray;
            }
            [Bindable(event="myStringValueChanged")]
            private function isOrangeChosen():Boolean
            {
                return myString == "Orange";
            }

            public function get fruit():String
            {
                return myString;
            }
            public function set fruit( str:String ):void
            {
                myString = str;
                dispatchEvent( new Event( "myStringValueChanged" ) );
            }

      
    </mx:Script>

    <mx:Label text="select a fruit:" />
    <mx:HBox>
        <mx:ComboBox id="fruitCB" change="{fruit = fruitCB.selectedLabel}" />
        <mx:Button label="Eat the orange." enabled="{isOrangeChosen()}" />
    </mx:HBox>

</mx:Application>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Open event for ComboBoxOpen event for ComboBox
2.Close event for ComboBoxClose event for ComboBox
3.Change event for ComboBoxChange event for ComboBox
4.Use changeEvent to display valueUse changeEvent to display value
5.open event and change event for ComboBoxopen event and change event for ComboBox
6.Information from ComboBox eventsInformation from ComboBox events