The
keyword is required when you use the
Bindable
information, see
In the following example, the component generates the
property changes:
flavorStr
[ChangeEvent("change")]
public var flavorStr:String;
When the event specified in the metadata occurs, Flash informs whatever is bound to the
property that the property has changed.
You can also instruct your component to generate an event when a getter or setter function is
called, as the following example shows:
[ChangeEvent("change")]
function get selectedDate():Date
In most cases, you set the
setter function.
You can register multiple
when the property changes, as the following example shows:
[ChangeEvent("change1")]
[ChangeEvent("change2")]
[ChangeEvent("change3")]
Any one of those events indicates a change to the variable. They do not all have to occur to
indicate a change.
Effect
The
metadata keyword defines the name of the property that you can assign to an effect
Effect
for the MXML tag.
The
metadata keyword has the following syntax:
Effect
[Effect("effect_name")]
The effect_name generally matches the event_name listed in the
Effect. The following example means that a tag may have a
the effect to play when the resize event triggers:
[Effect("resizeEffect")]
Event
Use the
metadata keyword to define events dispatched by this component. Add the Event
Event
statements outside the class definition in the ActionScript file so that they are bound to the class
and not a particular member of the class.
The
metadata keyword has the following syntax:
Event
[Event("event_name")]
62
Chapter 3: Creating Advanced Components in Flash MX 2004
"Bindable" on page
60.
event on the getter function, and dispatch the event on the
change
events in the metadata so that more than one event is generated
change
metadata keyword. For more
ChangeEvent
event when the value of the
change
metadata plus the word
Effect
property assigned to
resizeEffect
Need help?
Do you have a question about the FLEX - DEVELOPING COMPONENTS AND THEMES and is the answer not in the manual?
Questions and answers