Set style from the value in TextInput : TextInput Style « Components « Flex






Set style from the value in TextInput

Set style from the value in TextInput
           
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        public function showStyles():void {
            lb1.text = String(ip1.getStyle("fontSize"));
        }
        public function setNewStyles(newSize:Number):void {
            ip1.setStyle("fontSize",newSize);
        }
      </mx:Script>
    <mx:VBox id="vb">
        <mx:TextInput styleName="myClass" text="My attrs" id="ip1" width="400" />
        <mx:Label id="lb1" text="" width="400" />
        <mx:Button label="Get Style" click="showStyles();" />
        <mx:Button label="Set Style" click="setNewStyles(Number(ip2.text));" />
        <mx:TextInput text="" id="ip2" width="50" />
    </mx:VBox>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Set width for TextInputSet width for TextInput
2.TextInput Disabled ColorsTextInput Disabled Colors
3.Using getStyle() and setStyle() methods to change the Button's fontSize style and display the new size in the TextInputUsing getStyle() and setStyle() methods to change the Button's fontSize style and display the new size in the TextInput
4.Add Move effect to TextInputAdd Move effect to TextInput
5.Specify Styles for HTML in a TextFieldSpecify Styles for HTML in a TextField