开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜