Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 86

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

Advertisement

Alternatively, you can define these styles by using a class selector style declaration, as the
following example shows:
<?xml version="1.0"?>
<!-- mxml/myComponents/StateComboBoxWithStyleClassSel.mxml -->
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
styleName="myCBStyle">
<mx:Style>
.myCBStyle {
openDuration : 1000;
fontSize : 15;
}
</mx:Style>
<mx:dataProvider>
<mx:Array>
<mx:String>AK</mx:String>
<mx:String>AL</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
You cannot define a type selector in an MXML component. If you define a type selector,
a compiler error occurs.
Application developers can apply additional styles to the component. For example, if your
component defines styles for the open duration and font size, application developers can still
specify font color or other styles. The following example uses
StateComboBoxWithStyleProps.mxml in an application and specifies the font color style for
the control:
<?xml version="1.0"?>
<!-- mxml/MainStyleWithPropsAddColor.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*">
<MyComp:StateComboBoxWithStyleProps color="red"/>
</mx:Application>
Applying styles from the referencing file
When you reference an MXML component, the referencing file can specify style definitions
to the MXML component by using the following mechanisms:
Tag properties
86
Creating Simple MXML Components

Advertisement

Table of Contents
loading

Table of Contents