Dispatch Bindable event : Bindable Event « Data Model « 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 » Data Model » Bindable EventScreenshots 
Dispatch Bindable event
Dispatch Bindable 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:ArrayCollection id="fruitCollection">
            <mx:String>A</mx:String>
            <mx:String>B</mx:String>
            <mx:String>C</mx:String>
        </mx:ArrayCollection>
    
    <mx:Script>
        
            private var myStringValue:String;
            
            [Bindable(event="myStringValueChanged")]
            private function isOrangeChosen():Boolean
            {
                return myStringValue == "Orange";
            }
            
            public function get selectedFruit():String
            {
                return myStringValue;
            }
            public function set selectedFruitvalue:String ):void
            {
                myStringValue = value;
                dispatchEventnew Event"myStringValueChanged" ) );
            }
      
    </mx:Script>
    
    
    <mx:Label text="Select a Fruit:" />
    <s:HGroup>
        <s:DropDownList id="fruitCB" dataProvider="{fruitCollection}" change="{selectedFruit = fruitCB.selectedItem}"/>
        <mx:Button label="eat the orange." enabled="{isOrangeChosen()}"/>
    </s:HGroup>
    
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Bindable eventBindable event
2.Fire bindable event during value settingFire bindable event during value setting
3.Use [Bindable] metadata tag to specify to Flex to invoke the isEnabled()function in response to the event myFlagChanged.Use [Bindable] metadata tag to specify to Flex to invoke the isEnabled()function in response to the event myFlagChanged.
4.Bindable event and propertyBindable event and property
ww__w.___j__av_a___2s.___co___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.