Extra return in Textfields
01 December 2009 at 10:51 pm
Spent some time debugging a strange issue today where input-textfields always contained an undesired extra line. Since I found little info via Google, I’m posting it here for future reference.
If you make a multiline textfield with a border and autoSize set, you’ll see the problem easily. Every time the .htmlText property is set, an extra line is appended. It is not a newline character ( ), but rather a return ( ). This is done by the Flash Player itself and I can’t find a good reason? You can see the bug here (source). I’ve reported the bug in the Flash Player bugbase and initially I had no solution to the bug.
Then, my friend Fabrice found a solution. Adding this line after seting htmlText solves the issue:
tf.htmlText = tf.htmlText.substring(0,tf.htmlText.length-1);