开发者

Is there a function to adjust font size to make text field width smaller than a given width in actionscript?

开发者 https://www.devze.com 2023-04-01 02:23 出处:网络
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百科

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号