Example: Creating style properties
193
If you include the
<mx:Style>
tag, the
<mx:Style>
tag creates the default style definition, as
the following example shows:
<?xml version="1.0"?>
<!-- skinstyle\MainRectCSSStyles.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*">
<mx:Style>
StyledRectangle {fillColors: #FF00FF, #00FFFF}
</mx:Style>
<MyComp:StyledRectangle/>
</mx:Application>
Defining a style property for a skin
Flex lets you set component skins by using style properties. Your new component might also
support skins and, therefore, support setting skins by using style properties.
The mechanism for creating style properties to support skinning is the same as for creating
other style properties. Setting a style property for a skin that triggers a call to the
styleChanged()
method. The
styleChanged()
method detects the change to the skin, and
performs any updates to the appearance of the component in the
updateDisplayList()
method.
The one difference when defining a style property for a skin is how you specify the
[Style]
metadata tag. When the style property corresponds to a skin, you specify
Class
as the value to
the
type
property of the metadata tag, as the following example shows:
[Style(name="downSkin", type="Class", inherit="no")]
For more information on creating skins, see Chapter 20, “Using Skins,” in
Flex 2 Developer’s
Guide
.
Содержание 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...