Fire bindable event during value setting : 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 
Fire bindable event during value setting
Fire bindable event during value setting
           
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
    import flash.events.Event;
    [Bindable(event="myValueChanged")]
    private function isEnabled():String {
      if (myValue)
        return 'true';
      else
        return 'false';
    }
    private var _myValue:Boolean = false;
    public function set myValue(value:Boolean):void {
      _myValue = value;
      dispatchEvent(new Event("myValueChanged"));
    }
    public function get myValue():Boolean {
      return _myValue;
    }
  </mx:Script>
  <mx:TextArea id="myTA" text="{isEnabled()}" />
  <mx:Button label="Clear MyFlag" click="myValue=false;" />
  <mx:Button label="Set MyFlag" click="myValue=true;" />
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Bindable eventBindable event
2.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.
3.Bindable event and propertyBindable event and property
4.Dispatch Bindable eventDispatch Bindable event
w___w__w___.j_a__v___a_2__s__._c_om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.