User Guide

52 Using Metadata Tags in Custom Components
Before a public, protected, or private property defined as a variable to make that specific
property support binding.
The tag can have the following forms:
[Bindable]
public var foo;
The Flex compiler automatically generates an event named propertyChange for the
property. If the property value remains the same on a write, Flex does not dispatch the
event or update the property.
You can also specify the event name, as the following example shows:
[Bindable(event="fooChanged")]
public var foo;
In this case, you are responsible for generating and dispatching the event, typically as part
of some other method of your class. You can specify a
[Bindable] tag that includes the
event specification if you want to name the event, even when you already specified the
[Bindable] tag at the class level.
Before a public, protected, or private property defined by a getter or setter method.
You must define both a setter and a getter method to use the
[Bindable] tag with the
property. If you define just a setter method, you create a write-only property that you
cannot use as the source of a data-binding expression. If you define just a getter method,
you create a read-only property that you can use as the source of a data-binding expression
without inserting the
[Bindable] metadata tag. This is similar to the way that you can
use a variable, defined by using the
const keyword, as the source for a data binding
expression.
The tag can have the following forms:
[Bindable]
public function set shortNames(val:Boolean):void {
...
}
public function get shortNames():Boolean {
...
}
The Flex compiler automatically generates an event named propertyChange for the
property. If the property value remains the same on a write, Flex does not dispatch the
event or update the property. To determine if the property value changes, Flex calls the
getter method to obtain the current value of the property.