Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

TextField findings

Tobias Schneider edited this page Aug 14, 2014 · 2 revisions

Collection of findings about weirditis in the Flash TextField.

Note: These findings are valid for stylesheet-less textfields. Once a stylesheet is attached, a textfield behaves quite differently.

When using TextField#htmlText, all input is normalized, so reading htmlText out again can yield a very different string from the input.

When using TextField#htmlText, all line-breaking tokens cause new paragraphs to be created. That includes \n, \r, <br>, <sbr> and <p>.

When using TextField#htmlText, \r\n creates two line breaks.

foo<p>bar</p>baz creates a new paragraph after bar, but not after foo.

All formatting is repeated for every paragraph. That is, the <p> tag (and, optionally, the <textformat> tag) is always the outermost node.

Paragraph-formatting is spread out over three different tags: <textformat>, <p> and <font>. These are all always nested in the given order. <p> is always present and always contains the align attribute. <font> is also always present and always contains the attributes color, letterspacing and kerning, whereas <textformat> is only present if the values differ from the builtin defaults.

Setting any formatting that is expressed using <textformat> or <p> attributes will apply to the entire paragraph, even if the start and end indices lie full within the paragraph.

Setting htmlText on TextFields created from symbols resets bold and italic properties of the default text format.

When settting defaultTextFormat to a new value, properties with non-null values do not override the current format.