User Guide
Applying styles to your custom component 89
Applying a type selector to the root tag of a custom
component
All custom components contain a root tag that specifies the superclass of the component. In
the case of StateComboBox.mxml, the root tag is
<mx:ComboBox>. If you define a type
selector for the ComboBox control, or for a superclass of the ComboBox control, in your
main application file, that style definition is also applied to any custom component that uses a
ComboBox control as its root tag, as the following example shows:
<?xml version="1.0"?>
<!-- mxml/MainStyleOverrideUsingCBTypeSel.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*">
<mx:Style>
ComboBox {
openDuration: 1000;
fontSize: 15;
color: red;
}
</mx:Style>
<MyComp:StateComboBoxWithStyleProps/>
<mx:ComboBox/>
</mx:Application>
In this example, all ComboBox controls and all StateComboBox.mxml controls have an
openDuration of 1000 ms, fontSize of 15 points, and red text.