Get Number of characters selected from RichTextEditor : RichTextEditor « Components « Flex






Get Number of characters selected from RichTextEditor

Get Number of characters selected from RichTextEditor
     


<?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;
        [Bindable]
        
        public var htmlData:String="<textformat leading='2'><p align='center'><b><font size='20'>HTML Formatted Text</font></b></p></textformat>";
        public function changeSelectionText():void {
            var sel:TextRange = rte1.selection;
            var selLength:int = sel.endIndex - sel.beginIndex;
            if (selLength) {
                t1.text="Number of characters selected: " + String(selLength);

            }
        }
      </mx:Script>
    <mx:RichTextEditor id="rte1" htmlText="{htmlData}" width="100%"
        height="100%" mouseUp="changeSelectionText()" />
    <mx:TextArea editable="false" id="t1" fontSize="12"
        fontWeight="bold" width="300" height="180" />
</mx:Application>

   
    
    
    
    
  








Related examples in the same category

1.On value commit in a RichTextEditor, display value by reference its idOn value commit in a RichTextEditor, display value by reference its id
2.Fade RichTextEditorFade RichTextEditor
3.Change style for textArea in RichTextEditorChange style for textArea in RichTextEditor
4.htmltext with cdata inside RichTextEditor
5.Use RichTextEditor to display HTML formatted stringUse RichTextEditor to display HTML formatted string
6.Get font family for selected text in RichTextEditorGet font family for selected text in RichTextEditor
7.Get font size for selected text in RichTextEditorGet font size for selected text in RichTextEditor
8.Get color for selected text in RichTextEditorGet color for selected text in RichTextEditor
9.Replace text in RichTextEditor with TextRangeReplace text in RichTextEditor with TextRange
10.Creating a RichTextEditor control with Creating a RichTextEditor control with <mx:RichTextEditor>
11.Bind String to html Text property of RichTextEditorBind String to html Text property of RichTextEditor
12.RichTextEditor initialize eventRichTextEditor initialize event
13.creationComplete event for RichTextEditorcreationComplete event for RichTextEditor
14.Color picker for RichTextEditorColor picker for RichTextEditor
15.Remove the alignment buttons from a RichTextEditor controlRemove the alignment buttons from a RichTextEditor control
16.toolbar from RichTextEditortoolbar from RichTextEditor
17.Use the RichTextEditorUse the RichTextEditor
18.Set RichTextEditor to use system fontSet RichTextEditor to use system font
19.Compare the text and html text in RichTextEditorCompare the text and html text in RichTextEditor
20.Bind html text in RichTextEditor to TextAreaBind html text in RichTextEditor to TextArea
21.RichTextEditor CDATARichTextEditor CDATA
22.RichTextEditor ControlRichTextEditor Control
23.RichTextEditor Control With Formatted TextRichTextEditor Control With Formatted Text
24.RichTextEditor SubcontrolRichTextEditor Subcontrol
25.Remove Align Buttons from RichTextEditor's ToolBarRemove Align Buttons from RichTextEditor's ToolBar