Macromedia flex 2 Manuale
90
Creating Simple MXML Components
If you define a type selector for a superclass of the custom control, and for the custom control
itself, Flex ignores any conflicting settings from the type selector for the superclass, as the
following example shows:
itself, Flex ignores any conflicting settings from the type selector for the superclass, as the
following example shows:
<?xml version="1.0"?>
<!-- mxml/MainStyleOverrideUsingCBTypeSelConflict.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*">
<!-- mxml/MainStyleOverrideUsingCBTypeSelConflict.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*">
<mx:Style>
ComboBox {
color: red;
openDuration: 1000;
fontSize: 15;
}
StateComboBoxWithStyleProps {
color: green;
}
</mx:Style>
ComboBox {
color: red;
openDuration: 1000;
fontSize: 15;
}
StateComboBoxWithStyleProps {
color: green;
}
</mx:Style>
<MyComp:StateComboBoxWithStyleProps/>
<mx:ComboBox/>
</mx:Application>
<mx:ComboBox/>
</mx:Application>
In this example, the StateComboBox control uses green text, and the values for the
fontSize
and
openDuration
styles specified in the type selector for the ComboBox control.