0 Replies Latest reply on Feb 23, 2012 3:48 AM by UBianca

    adding space at the end of a ritchEditableText  line

    UBianca

      Hi!

      I found an interesting behaviour in my application.  I have a RichEditableText component with a fixed width . If I add text till almost the end of the line and then  insert spaces, the cursor get's stuck at the end of the line. My surprise was on retreiving the text from that line in the code, where all that spaces existed even if they were not visible in the app. So on screen you see let's say 3 spaces, but then you save the text you can get 10. If you keep inserting any letter the cursor will move itself to the next line, but this does not seem to be the case of " "(space).

       

      I tested it useing the following code. I'm useing 4.1 sdk.

      <s:RichEditableText id="richTxt"  width="100" height="500" change="richTxt_changeHandler(event)" />

      protected function richTxt_changeHandler(event:TextOperationEvent):void

                  {

                      var noOfLines:int = richTxt.textFlow.flowComposer.numLines;             

                      for (var i:int = 0; i < noOfLines; i++)

                      {

                          var startIndex:int = richTxt.textFlow.flowComposer.getLineAt(i).absoluteStart;

                          var seqLength:int = richTxt.textFlow.flowComposer.getLineAt(i).textLength-1;

                          var textLine:String = richTxt.text.substr(startIndex, seqLength);

                      }

                  }

      I try to set clipAndEnableScrolling=true; for richTxt but this thid not change anything.

      How can I retrieve only the visible text( with the corect number of spaces at the end of the line) from the RET in order to save it ?

      Thanks !