User Guide
54 Using Metadata Tags in Custom Components
In this example, the setter updates the value of the property, and then creates and dispatches
an event to invoke an update of the destination of the data binding.
In an MXML file, you can make all public properties that you defined as variables usable as
the source for data binding by including the
[Bindable] metadata tag in an <mx:Metadata>
block, as the following example shows:
<mx:Metadata>
[Bindable]
</mx:Metadata>
You can also use the [Bindable] metadata tag in an <mx:Script> block in an MXML file to
make individual properties that you defined as variables usable as the source for a data binding
expression. Alternatively, you can use the
[Bindable] metadata tag with properties that you
defined by using setter and getter methods.
Using read-only properties as the source for data binding
You can automatically use a read-only property defined by a getter method, which means no
setter method, as the source for a data-binding expression. Flex performs the data binding
once when the application starts.
Because the data binding from a read-only property occurs only once at application start up,
you omit the
[Bindable] metadata tag for the read-only property.
Using static properties as the source for data binding
You can automatically use a static constant as the source for a data-binding expression. Flex
performs the data binding once when the application starts. Because the data binding occurs
only once at application start up, you omit the
[Bindable] metadata tag for the static
constant.
You cannot use the
[Bindable] metadata tag with a static variable. If you do, the compiler
issues an error.