Assign color value to Number type variable : Style Color « Style « Flex






Assign color value to Number type variable

Assign color value to Number type variable
           

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Style>
        @namespace mx "http://www.adobe.com/2006/mxml";
        mx|Button { 
           color: #66CCFF; 
        }
    </mx:Style>
    <mx:Script>
        [Bindable]
        private var n:Number;

        public function changeStyles(e:Event):void {
            if (myButton.getStyle("color").toString(16) == "ff0000") {
                myButton.setStyle("color", 0x66CCFF);
            } else {
                myButton.setStyle("color", "Red");
            }
            n = myButton.getStyle("color"); 
        }
      </mx:Script>
    <mx:Button id="myButton" label="Click Here" click="changeStyles(event)" />
    <mx:Label id="myLabel" text="0x{n.toString(16).toUpperCase()}" />
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.VGA color name for CSS style definitions and tag supportVGA color name for CSS style definitions and <mx:Style> tag support
2.Apply color and font style to a Button with CSSApply color and font style to a Button with CSS
3.CSS style definitions and the tag support hexadecimal color and color name value formatsCSS style definitions and the <fx:Style> tag support hexadecimal color and color name value formats
4.Convert color style to StringConvert color style to String
5.Define custom color and line style for the bubblesDefine custom color and line style for the bubbles
6. tag styles specify blue, italic, 14 point text, and the tag includes HTML tags that override the color and point size.<mx:Text> tag styles specify blue, italic, 14 point text, and the <mx:htmlText> tag includes HTML tags that override the color and point size.
7.Use the errorTip style to change the colorUse the errorTip style to change the color
8.Get colorGet color