Specify Styles for HTML in a TextField : TextInput Style « Components « Flex






Specify Styles for HTML in a TextField

Specify Styles for HTML in a TextField
             

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="1000" height="800" creationComplete="createStyle()">
    <mx:Script>
        
            private var styleText:String = '.largered {  font-family:Arial, Helvetica;font-size:16; color: #ff0000; }' +
                    '.smallblue { font-size: 11; color: #0000ff; font-family:Times NewRoman, Times; }';

            [Bindable]
            private var lipsum:String = "<span class='largered'>Large</span>"+
                " <span class='smallblue'>small</span>";

            [Bindable]
            private var style:StyleSheet;

            private function createStyle():void
            {
                style = new StyleSheet();
                style.parseCSS(styleText);
                text.styleSheet = style;
                text.htmlText = lipsum;
            }

      
    </mx:Script>
    <mx:TextArea id="text" width="200" height="300"/>
</mx:Application>
    
    

   
    
    
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Set width for TextInputSet width for TextInput
2.Set style from the value in TextInputSet style from the value in TextInput
3.TextInput Disabled ColorsTextInput Disabled Colors
4.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
5.Add Move effect to TextInputAdd Move effect to TextInput