Set font size for TextRange : TextRange « Components « Flex






Set font size for TextRange

Set font size for TextRange
      
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="600"
    height="500">
    <mx:Script>
        import mx.controls.textClasses.TextRange
        public function alterText():void {
            var tr1:TextRange = new TextRange(ta1, false,ta1.text.indexOf("is", 0), ta1.text.indexOf(".", 0));
            tr1.htmlText="<i>italic HTML text</i>"
            var tr2:TextRange = new TextRange(ta1, true, ta1.text.indexOf("t",0), ta1.text.length-1);
            tr2.fontSize=18;
        }
      </mx:Script>
    <mx:TextArea id="ta1" fontSize="12" fontWeight="bold" width="100%"
        height="100">
        <mx:text>
            this is a test.
        </mx:text>
    </mx:TextArea>
    <mx:Button label="Alter Text" click="alterText();" />
</mx:Application>

   
    
    
    
    
    
  








Related examples in the same category

1.Set html text to TextRangeSet html text to TextRange
2.Set color for TextRangeSet color for TextRange
3.Set font style for TextRangeSet font style for TextRange
4.Set font weight for TextRangeSet font weight for TextRange
5.Set selection range for TextRangeSet selection range for TextRange
6.TextRange Selected TextTextRange Selected Text
7.Set the Style Properties for Text RangesSet the Style Properties for Text Ranges