Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

Extra First Line in a Multi-lined TextField (Flash Pro)

Posted June 23, 2009 by senocular

Part two of things I didn't know... And this has been something that has bugged me for years.

Have you ever added text through ActionScript to a multi-lined text field created in Flash Professional (Flash Authoring) and frustratingly found that the text immediately starts one line below where you think it should? Me too! Thankfully glosrfc pointed out to me why that is...
Apparently this is due to the formatting Flash throws into the text field, namely for Auto kern (possibly others, but Auto kern was messing with me in this case). Since this formatting is represented with HTML, it's in the form of a paragraph (p) tag in the htmlText. Combine that pre-established formatting with new text added through ActionScript - and this includes new non-HTML text - and you get a text field that has new text showing up on the next line down from the first.

Source.