56
Using Metadata Tags in Custom Components
You insert the
[Effect]
metadata tag before the class definition in an ActionScript file, or in
the
<mx:Metadata>
block in an MXML file. The
[Effect]
metadata tag has the following
syntax:
[Effect(name="
eventName
Effect", event="
eventName
")]
The following table describes the properties of the [
Effect]
metadata tag:
The
[Effect]
metadata tag is often paired with an
[Event]
metadata tag, where the
[Event]
metadata tag defines the event corresponding to the effect’s trigger. By convention,
the name of the effect is the event name with the suffix
Effect
, as the following example of
an ActionScript file shows:
// Define event corresponding to the effect trigger.
[Event(name="darken", type="flash.events.Event")]
// Define the effect.
[Effect(name="darkenEffect", event="darken")]
class ModalText extends TextArea {
...
}
In an MXML file, you can define the event and effect in an
<mx:Metadata>
block, as the
following example shows:
<mx:Metadata>
[Event(name="darken", type="flash.events.Event")]
[Effect(name="darkenEffect", event="darken")]
</mx:Metadata>
Event metadata tag
Use the
[Event]
metadata tag to define the MXML property for an event and the data type of
the event object that a component emits. You insert the
[Event]
metadata tag before the class
definition in an ActionScript file, or in the
<mx:Metadata>
block in an MXML file.
For more information on defining custom events, see
Chapter 4, “Creating Custom Events,”
on page 35
.
The
[Event]
metadata tag has the following syntax:
[Event(name="
eventName
", type=
"package.eventType"
)]
Property
Type
Description
eventNameEffect
String
Specifies the name of the effect.
eventName
String
Specifies the name of the event that triggers the effect.
Содержание FLEX 2 - CREATING AND EXTENDING COMPONENTS
Страница 1: ...Creating and Extending Flex 2 Components Adobe Flex 2...
Страница 6: ...6 Contents...
Страница 10: ...10 About Flex Documentation...
Страница 12: ......
Страница 24: ...24 Creating Flex Components...
Страница 74: ...74 Compiling Components...
Страница 76: ......
Страница 118: ...118 Creating Advanced MXML Components...
Страница 120: ......
Страница 182: ...182 Creating Advanced Visual Components in ActionScript...
Страница 194: ...194 Creating Custom Style Properties...
Страница 204: ...204 Creating Template Components...
Страница 206: ......
Страница 216: ...216 Creating Custom Formatters...
Страница 254: ...254 Index...