Metadata tags
57
The following table describes the properties of the [
Event]
metadata tag:
The following example identifies the
myClickEvent
event as an event that the component
can dispatch:
[Event(name="myClickEvent", type="flash.events.Event")]
If you do not identify an event in the class file with the
[Event]
metadata tag, the MXML
compiler generates an error if you try to use the event name in MXML. Any component can
register an event listener for the event in ActionScript by using the
addEventListener()
method, even if you omit the
[Event]
metadata tag.
The following example identifies the
myClickEvent
event as an event that an ActionScript
component can dispatch:
[Event(name="myEnableEvent", type="flash.events.Event")]
public class MyComponent extends UIComponent
{
...
}
The following example shows the
[Event]
metadata tag in the
<mx:Metadata>
tag in an
MXML file:
<?xml version="1.0"?>
<!-- TextAreaEnabled.mxml -->
<mx:TextArea xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Metadata>
[Event(name="myEnableEvent", type="flash.events.Event")]
</mx:Metadata>
....
</mx:TextArea>
IconFile metadata tag
Use the
[IconFile]
metadata tag to identify the filename for the icon that represents the
component in the Insert bar of Flex Builder.
Property Type
Description
eventName
String
Specifies the name of the event, including its package name.
eventType
String
Specifies the class that defines the data type of the event object. The
class name is either the base event class, Event, or a subclass of the
Event class.
Содержание 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...