Set selection range for TextRange : TextRange « Components « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Components » TextRangeScreenshots 
Set selection range for TextRange
Set selection range 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);
            ta1.setSelection(03);
        }
      </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 size for TextRangeSet font size for TextRange
4.Set font style for TextRangeSet font style for TextRange
5.Set font weight for TextRangeSet font weight for TextRange
6.TextRange Selected TextTextRange Selected Text
7.Set the Style Properties for Text RangesSet the Style Properties for Text Ranges
w___w___w_.j___a__v_a___2_s_.___c_om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.