Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 54

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

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
metadata tag in an
[Bindable]
<mx:Metadata>
block, as the following example shows:
<mx:Metadata>
[Bindable]
</mx:Metadata>
You can also use the
metadata tag in an
block in an MXML file to
[Bindable]
<mx:Script>
make individual properties that you defined as variables usable as the source for a data binding
expression. Alternatively, you can use the
metadata tag with properties that you
[Bindable]
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
metadata tag for the read-only property.
[Bindable]
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
metadata tag for the static
[Bindable]
constant.
You cannot use the
metadata tag with a static variable. If you do, the compiler
[Bindable]
issues an error.
54
Using Metadata Tags in Custom Components

Advertisement

Table of Contents
loading

Table of Contents