Apply style properties to the Button, myStyle, and global style names
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp(event)">
<mx:Style>
.myStyle {
color: red;
}
</mx:Style>
<mx:Script>
import mx.styles.StyleManager;
public function initApp(e:Event):void {
StyleManager.getStyleDeclaration("Button").setStyle("fontSize",24);
StyleManager.getStyleDeclaration(".myStyle").setStyle("color",0xCC66CC);
StyleManager.getStyleDeclaration("global").setStyle("fontStyle","italic");
}
</mx:Script>
<mx:Button id="myButton" label="Click Here" styleName="myStyle" />
<mx:Label id="myLabel" text="This is a label" styleName="myStyle" />
</mx:Application>
Related examples in the same category