2 Replies Latest reply: Feb 8, 2013 2:05 PM by olegkon RSS

    TextArea ignoring new lines

    olegkon Community Member

      Hi,

       

      I am working on old Flex3 (Cairngorm2) app.

      One of TextArea's there is completely ignoring new lines (Carriage Return/Line Feed)

      and even skips some spaces (others work fine).

       

      Code is pretty simple (well, little simplified here):

      <fx:TextArea  text="myText" selectable=true change=updateText(event)"/>

      ...

       

      private function updateText(evt:Event):void {

        var event:UpdateEvent = new UpdateEvent(UpdateEvent.UPDATE_EVENT);

        event.myText=myText.text;

         trace("myText"+event.myText) //added by me

        event.dispatch();

      }

       

       

      I have read about weird behaviors of TextArea (skipping or even doubling some characters) on the net,

      but so far could not find anything applicable in that case.

       

      For example, something like    myText.text.replace("\n", "\r") doesn't change anything.

      I guess, there is no "\n" there.

       

      If I trace, it returns line without newlines (like:  'startskip1lineskip2linesend;').

      But if I copy-paste that line to say another TextArea on the screen (or non flex Chat app, I would get multiline text:

      'start

       

      skip1line

       

       

      skip2lines

      end;

       

      And for various reasons I can't debug that app.

       

      Any idea what might be wrong and how to fix it?

       

      Please help!

       

      TIA,

      Oleg.

      P.S.:  App connects to SPs in the Database via Web Service. No BlazeDS.

        • 1. Re: TextArea ignoring new lines
          Flex harUI Adobe Employee

          I  haven’t heard of this problem before.  I’d guess there is code running that is removing the line breaks.  I would first check to see if both \r and \n are being removed or not.  Then I’d add a keyDown handler and single step in the debugger through the hundreds of lines of code that run when you hit a key.  My guess is that you’ll end up in code you didn’t expect that is removing the whitespace.

          • 2. Re: TextArea ignoring new lines
            olegkon Community Member

            I can see '\r' (backslash R) characters there, not '\n' (backslash N).

            Should I try to replace '\r' with '\n'? or any other characters?