Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 193

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

If you include the
<mx:Style>
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
method. The
styleChanged()
performs any updates to the appearance of the component in the
method.
The one difference when defining a style property for a skin is how you specify the
metadata tag. When the style property corresponds to a skin, you specify
the
property of the metadata tag, as the following example shows:
type
[Style(name="downSkin", type="Class", inherit="no")]
For more information on creating skins, see Chapter 20, "Using Skins," in Flex 2 Developer's
Guide.
tag, the
<mx:Style>
method detects the change to the skin, and
styleChanged()
tag creates the default style definition, as
updateDisplayList()
Class
Example: Creating style properties
[Style]
as the value to
193

Advertisement

Table of Contents
loading

Table of Contents