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