在ActionScript 3中,我的文本字段
有:
In actionscript 3, my TextField
has :
...当使用斜体非常正确的字符被稍稍切去(特别是盖)。 它基本上看来,它没有检测到合适的尺寸。
... when italics are used the very right character gets slightly cut off (specially caps). It basically seems that it fails detecting the right size.
我以前有这个问题,但只是想知道有没有一个很好的解决方法(而不是检查输出textWidth
或偏移文本等)?
I've had this problem before but just wondered is there a nice workaround (instead of checking textWidth
or offsetting text etc.)?
初始化你的 textField的
为你总是这样,采用多线,自动调整,的htmlText ...
Initialize your textField
as you always do, using multiline, autosize, htmlText...
然后做这个小动作:
// saving wanted width and height plus 1px to get some space for last char
var savedWidth = myTextField.width + 1;
var savedHeight = myTextField.height + 1;
// removing autoSize, wich is the origin of the problem i think
myTextField.autoSize = "none";
// now manually autoSizing the textField with saved values
myTextField.width = savedWidth;
myTextField.height = savedHeight;