User Guide

156 Creating Components
About the ChangeEvent tag
The ChangeEvent tag tells data binding that the component will generate an event any time
the value of a specific property changes. In response to the event, data binding executes any
binding that has that property as a source. The component only generates the event if you
write appropriate ActionScript code in the component. The event should be included in the
list of Event metadata declared by the class.
You can declare a property by using
var or getter/setter methods. If a property has both a
getter and a setter method, you only need to apply the ChangeEvent tag to one.
The ChangeEvent tag has the following syntax:
[Bindable]
[ChangeEvent("event")]
property_declaration or getter/setter function
In the following example, the component generates the change event when the value of the
bindable property
flavorStr changes:
[Bindable]
[ChangeEvent("change")]
public var flavorStr:String;
When the event that is specified in the metadata occurs, Flash notifies bindings that the
property has changed.
You can register multiple events in the tag, as the following example shows:
[ChangeEvent("change1", "change2", "change3")]
Any one of those events indicates a change to the property. They do not all have to occur to
indicate a change.