From Flex help document.....
The following example uses the [Bindable] metadata tag for a variable
and a getter property. The example also shows how to call the
dispatchEvent() function.
[Bindable]
public var minFontSize:Number = 5;
[Bindable("textChanged")]
public function get text():String {
return myText;
}
public function set text(t : String):void {
myText = t;
dispatchEvent( new Event( "textChanged" ) );}
====================================================================
In the following example, you use the [Bindable] metadata tag to
specify to Flex to invoke the isEnabled()function in response to the
event myFlagChanged. When the myFlag setter gets called, it dispatches
the myFlagChanged event to trigger any data bindings that use the
isEnabled()function as the source:
<?xml version="1.0"?>
<!-- binding/ASFunction.mxml -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.events.Event;
// Define a function that gets invoked
// in response to the myFlagChanged event.
[Bindable(event="myFlagChanged")]
private function isEnabled():String {
if (myFlag)
return 'true';
else
return 'false';
}
private var _myFlag:Boolean = false;
// Define a setter method that dispatches the
// myFlagChanged event to trigger the data binding.
public function set myFlag(value:Boolean):void {
_myFlag = value;
dispatchEvent(new Event("myFlagChanged"));
}
public function get myFlag():Boolean {
return _myFlag;
}
]]>
</mx:Script>
<!-- Use the function as the source of a data binding expression.
-->
<mx:TextArea id="myTA" text="{isEnabled()}"/>
<!-- Modify the property, causing the setter method to
dispatch the myFlagChanged event to trigger data binding. -->
<mx:Button label="Clear MyFlag" click="myFlag=false;"/>
<mx:Button label="Set MyFlag" click="myFlag=true;"/>
</mx:Application>