Event Flex



    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark">
    
        
    

    
         
            import flashx.textLayout.elements.TextRange; 
            import flashx.textLayout.elements.*; 
            private function selectSomeText(e:Event):void { 
                /* Get the location of the cursor. This is the character position of the 
                cursor in the RichEditableText control after the user clicks on it. */ 
                var activePos:int = richTxt1.selectionActivePosition; 
                /* Get the first SpanElement in the TextFlow. */ 
                var leaf:SpanElement = new SpanElement(); 
                leaf = SpanElement(richTxt1.textFlow.getFirstLeaf()); 
                /* Get the start and end index values for the first SpanElement. */ 
                var spanStart:int = leaf.getParagraph().parentRelativeStart; 
                var spanEnd:int = leaf.getParagraph().parentRelativeEnd; 
                /* For the first SpanElement, if the cursor position falls within the 
                SpanElement's character range, then select the entire SpanElement. */ 
                if (activePos >= spanStart && activePos <= spanEnd) { 
                    selectSpan(spanStart, spanEnd); 
                    return; 
                } 
                /* Perform the same operations for each leaf in the TextFlow. */ 
                while(leaf = SpanElement(leaf.getNextLeaf())) { 
                    spanStart = leaf.getParagraph().parentRelativeStart; 
                    spanEnd = leaf.getParagraph().parentRelativeEnd; 
                    if (activePos >= spanStart && activePos <= spanEnd) { 
                        selectSpan(spanStart, spanEnd); 
                        return; 
                    } 
                } 
            } 
            private function selectSpan(i1:int, i2:int):void { 
                richTxt1.selectRange(i1, i2); 
            } 
          
    

    
                    selectable="true" editable="true" textAlign="justify"
            percentWidth="100">
            
                
                    
                        
                            1) Lorem ipsum dolor sit amet, consectetur
                            adipiscing elit.
                        

                    

                    
                        
                            2) Cras posuere posuere sem, eu congue orci mattis
                            quis.
                        

                    

                    
                        
                            3) Curabitur pulvinar tellus venenatis ipsum tempus
                            lobortis.