1 Reply Latest reply on Nov 16, 2011 9:24 AM by Ijimero

    [Flex 3]Inserting text on RichTextEditor without losing formatation?

    Ijimero Level 1

      Hey gus!


      I'm trying to insert a external text into my RichTextEditor using a Button, but the way i'm doing it makes the text to lose it's formatation, it assumes the current formatation of the line that I've inserted the text... If the line has fontSize = 12 and bold, all the text assume that...


      Currently I'm inserting the text like this:


        var text:String = rte.text; //rte = RichTextEditor
          var parameter:String = ComboBox(HBox(event.currentTarget.parent).getChildAt(1)).selectedItem.emaParGCodigo;


          rte.text = text.slice(0, rte.selection.beginIndex) + parameter + text.slice(rte.selection.endIndex);


      I believe I need to find a way to insert the text directly into the htmlText, but i can't find a way to get the correct indexes, since I'm using the selection.beginIndex and selection.endIndex as the Index to modify my text, but obviously this index are from the text, and not for the htmlText...


      can anybody help me?


      thanks in advance, and sorry for bad english... =)