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_declaration
s;
Содержание 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...