User Guide

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.