Is there a function to adjust font size to make text field width smaller than a given width in actionscript?
Is there a function or property or better way to do what the following code do?
var width:int = 20
while (textField.defaultTextFormat.size > 1 && textField.width > width) 开发者_JAVA百科{
textField.defaultTextFormat.size--
}
There is no built-in method for that. Another way, depending on what you're trying to do, would be to scale the textfield so that it fits within the required width:
var scale:Number = targetWidth / textField.textWidth;
textField.scaleX = scale;
textField.scaleY = scale;
精彩评论