About styles
185
Setting styles using MXML tag attributes
Component users can use MXML tag attributes to set a style property on a component. For
example, the following code creates a TextArea control, then sets the
backgroundColor
style
of the component to blue (0x0000FF):
<mx:TextArea id="myTA" backgroundColor="0x0000FF"/>
Setting styles using the setStyle() method
Component users can use the
setStyle()
method to set a style property on a component.
For example, the following code creates a
TextArea
control, then sets the
backgroundColor
style of the component to blue (0x0000FF):
var myTA:TextArea=new TextArea()
myTA.setStyle('backgroundColor', 0x0000FF);
Setting styles using CSS
Component users can use the
<mx:Styles>
tag to set CSS styles in an MXML application, as
the following example shows:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*" >
<mx:Style>
TextArea {backgroundColor: "0x0000FF"}
</mx:Style>
<mx:TextArea/>
</mx:Application>
You can also import an external CSS file, as the following example shows:
<mx:Style source="myStyle.css"/>
Содержание FLEX 2 - CREATING AND EXTENDING COMPONENTS
Страница 1: ...Creating and Extending Flex 2 Components Adobe Flex 2...
Страница 6: ...6 Contents...
Страница 10: ...10 About Flex Documentation...
Страница 12: ......
Страница 24: ...24 Creating Flex Components...
Страница 74: ...74 Compiling Components...
Страница 76: ......
Страница 118: ...118 Creating Advanced MXML Components...
Страница 120: ......
Страница 182: ...182 Creating Advanced Visual Components in ActionScript...
Страница 194: ...194 Creating Custom Style Properties...
Страница 204: ...204 Creating Template Components...
Страница 206: ......
Страница 216: ...216 Creating Custom Formatters...
Страница 254: ...254 Index...