Инструкция для Macromedia flex 2
Metadata tags
51
The following table describes the property of the [
ArrayElementType]
metadata tag:
Bindable metadata tag
When a property is the source of a data binding expression, Flex automatically copies the
value of the source property to any destination property when the source property changes. To
signal to Flex to perform the copy, you must use the
value of the source property to any destination property when the source property changes. To
signal to Flex to perform the copy, you must use the
[Bindable]
metadata tag to register the
property with Flex, and the source property must dispatch an event.
The
[Bindable]
metadata tag has the following syntax:
[Bindable]
[Bindable(event="eventname")]
[Bindable(event="eventname")]
If you omit the event name, Flex automatically creates an event named
propertyChange
.
You can use the
[Bindable]
metadata tag in three places:
■
Before a public class definition.
The
[Bindable]
metadata tag makes usable as the source of a binding expression all
public properties that you defined as variables, and all public properties that are defined
by using both a setter and a getter method. In this case,
by using both a setter and a getter method. In this case,
[Bindable]
takes no parameters,
as the following example shows:
[Bindable]
public class TextAreaFontControl extends TextArea {}
public class TextAreaFontControl extends TextArea {}
The Flex compiler automatically generates an event named
propertyChange
for all public
properties so that the properties can be used as the source of a data binding expression. In
this case, specifying the
this case, specifying the
[Bindable]
metadata tag with no event is the same as specifying
the following:
[Bindable(event="propertyChange")]
If the property value remains the same on a write, Flex does not dispatch the event or
update the property.
update the property.
Property
Type
Description
elementType
String
Specifies the data type of the Array elements, and can be one of
the ActionScript data type, such as String, Number, class, or
interface.
the ActionScript data type, such as String, Number, class, or
interface.
NOT
E
When you use the
[Bindable]
metadata tag before a public class definition, it only
applies to public properties; it does not apply to private or protected properties, or to
properties defined in any other namespace. You must insert the
properties defined in any other namespace. You must insert the
[Bindable]
metadata
tag before a nonpublic property to make it usable as the source for a data binding
expression.
expression.