# TextField.appendText problem with "\\r"

**URL:** <https://forum.kirupa.com/t/textfield-appendtext-problem-with-r/287172>\
**Category:** flash\
**Created:** [April 27, 2009, 3:19pm UTC](https://forum.kirupa.com/t/textfield-appendtext-problem-with-r/287172 "2009-04-27T15:19:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![subx](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@subx](https://forum.kirupa.com/u/subx)\
**Post date:** [April 27, 2009, 3:19pm UTC](https://forum.kirupa.com/t/textfield-appendtext-problem-with-r/287172/1 "2009-04-27T15:19:43Z")

</div>

Maybe this is a well known problem that people just don’t like to talk about, or perhaps I’ve not managed to hit upon the correct search terms, but I can’t find any discussion of this issue. People must have come across this before though…

TextField’s appendText method seems to have a fairly large bug with “\r” characters.

Examples: (using a TextField called “txt”)

```auto

txt.text += "ABC\r";
txt.text += "DEF\r";
txt.text += "GHI\r";
txt.text += "JKL\r";

```

As expected, txt contains:  
ABC  
DEF  
GHI  
JKL

```auto
 
txt.appendText("ABC
");
txt.appendText("DEF
");
txt.appendText("GHI
");
txt.appendText("JKL
");

```

Gives the same expected result.

```auto

txt.appendText("ABC\r");
txt.appendText("DEF\r");
txt.appendText("GHI\r");
txt.appendText("JKL\r");

```

Gives this:  
ABCDEFGHIJKL

…followed by four new lines!

```auto
 
txt.appendText("ABC\rDEF\r");
txt.appendText("GHI\rJKL\r");
txt.appendText("MNO\rPQR\r");
txt.appendText("STU\rVWX\r");

```

This gives you:

ABC  
DEGHI  
JKMNO  
PQSTU  
VWX  
R  
L  
F

Not good.

The fun really begins when you have long strings full of "  
" - your appended text starts appearing all over the place.

So I guess I’m going to need to put in a find and replace everytime I use appendText from now on, unless I’m missing something or anyone else has got any better ideas.
