Macromedia flex 2 Manual

Página de 254
58
Using Metadata Tags in Custom Components
The 
[IconFile]
 metadata tag has the following syntax:
[IconFile("fileName")]
The 
fileName
 property specifies a PNG, GIF, or JPEG file that contains the icon, as the 
following example shows: 
[IconFile("MyButton.png")]
public class MyButton extends Button
{
...
}
Inspectable metadata tag
The 
[Inspectable]
 metadata tag defines information about an attribute of your component 
that you expose in code hints and in the Property Inspector area of Flex Builder. The 
[Inspectable]
 metadata tag is not required for either code hints or the Property Inspector. 
The following rules determine how Flex Builder displays this information:
All public properties in components appear in code hints and in the Flex Builder Property 
Inspector. If you have extra information about the property that you want to add, such as 
enumeration values or that a String property represents a file path, then add the 
[Inspectable]
 metadata tag with that information.
Code hints for components and the information in the Property Inspector come from the 
same data. Therefore, if the attribute appears in one, it should appear in the other.
Code hints for ActionScript components do not require metadata to work correctly so you 
always see the appropriate code hints, depending the current scope. Flex Builder uses the 
public
protected
private
, and 
static
 keywords plus the current scope to determine 
which ActionScript code hints to show.
The 
[Inspectable]
 metadata tag must immediately precede the property’s variable 
declaration or the setter and getter methods to be bound to that property. 
The 
[Inspectable]
 metadata tag has the following syntaxes:
[Inspectable(attribute=value[,attribute=value,...])]
property_declaration name:type;
[Inspectable(attribute=value[,attribute=value,...])]
setter_getter_declarations;