Macromedia flex 2 Manual
Example: Creating style properties
189
Defining a style property
You define a style property for a component in the class definition.
To define a new style property:
1.
Insert the
[Style]
metadata tag that defines the style before the class definition.
You insert the
[Style]
metadata tag before the class definition to define the MXML tag
attribute for a style property. If you omit the
[Style]
metadata tag, the MXML compiler
issues a syntax error when you try to set the property as an MXML tag attribute.
The
[Style]
metadata tag has the following syntax:
[Style(name="style_name"[,property="value",...])]
For more information, see
.
2.
Override the
styleChanged()
method to detect changes to the property.
3.
Override
updateDisplayList()
method to incorporate the style into the component
display.
4.
Define a static initializer to set the default value of the style property.
For more information, see
.