using the setStyle() method from event target to change style for controls
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()">
<mx:Script>
public function initApp():void {
StyleManager.getStyleDeclaration("Button").setStyle("themeColor",0x6666CC);
StyleManager.getStyleDeclaration("Button").setStyle("color","Blue");
}
public function changeStyles(e:Event):void {
e.currentTarget.setStyle("themeColor", 0xFF0099);
e.currentTarget.setStyle("color", "Red");
}
</mx:Script>
<mx:Button id="myButton" label="Click Here" click="changeStyles(event)" />
</mx:Application>
Related examples in the same category