2 Replies Latest reply on Aug 17, 2007 8:06 PM by fancycarp

    Problem modifying text in TextArea using TextRange object

    fancycarp
      Hi

      I'm working with TextArea and TextRange class and encounter some problem.

      I have
      - One TextArea containing text "AAABBBCCC"
      - One Button

      I select "AAA" and press the Button, I try to change the selected text to "XXX" using the following code :

      var range:TextRange = new TextRange(myTextArea, false, myTextArea.selectionBeginIndex, myTextArea.selectionEndIndex);
      range.text = "XXX";
      trace(myTextArea.text);

      I see that the text appears "XXXBBBCCC" as need but the myTextArea.text remains unchanged...Why?
      How can I get the new text?

      Thanks