Alternatively, you might develop a component that you want to deploy with a built-in look so
that it is not necessary for application developers to apply any additional styles to it. This type
of component might be useful for applications that require a header or footer with a fixed
look, while the body of the application has more flexibility in its look.
Or, you might develop a custom component by using a combination of these approaches.
This type of design lets application developers set some styles, but not others.
This section describes several options for applying styles to your custom components. For
general information on Flex styles, see Chapter 18, "Using Styles and Themes," in Flex 2
Developer's Guide. For information on creating custom styles, see
Custom Style Properties," on page
Applying styles from the custom component
You can choose to define styles within your MXML component so that the component has
the same appearance whenever it is used, and application developers do not have to worry
about applying styles to it.
In the definition of your custom component, you define styles by using one or both of the
following mechanisms:
Tag properties
■
Class selectors
■
The following custom component defines a style by using a tag property of the
control:
<?xml version="1.0"?>
<!-- mxml/myComponents/StateComboBoxWithStyleProps.mxml -->
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
openDuration="1000"
fontSize="15">
<mx:dataProvider>
<mx:Array>
<mx:String>AK</mx:String>
<mx:String>AL</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
183.
Applying styles to your custom component
Chapter 11, "Creating
ComboBox
85