Skip to content
11.03.11 / ktu;

htmlText and empty lines

today, i was working on a problem that involved TextField, and more specifically, using values from the last line of text. i was trying to get the TextLineMetric of the the last line to do some calculations. this was all fine and dandy until I coupled this new utility with another that modifies the htmlText property of the TextField i was working with. here is what i learned:

changing the value of htmlText on a TextField always creates one extra empty line of text.

i found no indication as to why, and i could see by doing plenty of traces that the htmlText did not indicate to create any new line of text.

so here is the fix:

textField.replaceText(textField.text.length - 1, textField.text.length, "");

apparently that grabs our magic extra line and gets rid of it. great.

i may update this post to include some of the test that i did which proved that changing htmlText always results in this extra line, but another time.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.