using the setStyle() method from event target to change style for controls : Style Event « Style « Flex






using the setStyle() method from event target to change style for controls

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

1.Style error event handlerStyle error event handler
2.Style complete event handlerStyle complete event handler
3.Styles Event