Skip to content

Instantly share code, notes, and snippets.

Last active July 19, 2019 13:35
What would you like to do?
Messure text/string in textfield
public static function measureString(str:String, format:TextFormat) : Number {
var textField:TextField = new TextField();
textField.autoSize = TextFieldAutoSize.LEFT; // adjust appropriately
textField.defaultTextFormat = format;
textField.text = str;
return textField.textWidth;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment