BIT-101 [2003-2017]

getTextExtent2


I love digging through the class files in Flash MX 2004.

You find neat little tidbits like getTextExtent2, where it is admitted that TextFormat.getTextExtent is broken in Flash.

The solution? They create an invisible text field on _root, at a depth of -2. Assign it the text and the format in question, autosize it, measure its resulting textWidth and textHeight and return that.

Thats all in classes/mx/core/ext/UIObjectExtensions.as

« Previous Post
Next Post »