Style Flex


    
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
    creationComplete="initApp()">
    
        
    

     
         
        private var myButtonStyle:CSSStyleDeclaration = new CSSStyleDeclaration('myButtonStyle'); 
        private var myLabelStyle:CSSStyleDeclaration = new CSSStyleDeclaration('myLabelStyle'); 
        private var myTextAreaStyle:CSSStyleDeclaration =new CSSStyleDeclaration('myTextAreaStyle'); 
        private function initApp():void { 
            myButtonStyle.setStyle('color', 'blue'); 
            myLabelStyle.setStyle('color', 'blue'); 
            myTextAreaStyle.setStyle('color', 'blue'); 
        } 
        private function applyStyles():void { 
            styleManager.setStyleDeclaration("spark.components.Button", myButtonStyle, false); 
            styleManager.setStyleDeclaration("spark.components.Label", myLabelStyle, false); 
            styleManager.setStyleDeclaration("spark.components.TextArea", myTextAreaStyle,true); 
        }