Actionscript 3 文本字段高度
我需要将文本字段自动调整大小属性设置为 NONE,以确保 HTML 链接不会在翻转时跳转。
但是,当我这样做时,如何设置文本字段高度属性以显示所有文本而不滚动?
我已经尝试了以下方法,但由于我无法弄清楚的原因,它挤压了我的文本高度:
htmlTextField.autoSize = TextFieldAutoSize.LEFT;
htmlTextField.htmlText = htmlText;
var recordedHeight:Number = htmlTextField.textHeight;
htmlTextField.autoSize = TextFieldAutoSize.NONE;
htmlTextField.height = recordedHeight + htmlTextField.getTextFormat().leading + 1;
I need to set the text field autosize property to NONE to ensure that HTML links do not jump on rollovers.
However, when I do this, how can I set the textfield height property to show all of the text without scrolling?
I have tried the following but for a reason I cannot figure out, it's squishing the height of my text:
htmlTextField.autoSize = TextFieldAutoSize.LEFT;
htmlTextField.htmlText = htmlText;
var recordedHeight:Number = htmlTextField.textHeight;
htmlTextField.autoSize = TextFieldAutoSize.NONE;
htmlTextField.height = recordedHeight + htmlTextField.getTextFormat().leading + 1;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
文本字段具有 2px 装订线所以这可能会让你绊倒。
TextFields have a 2px gutter all the way around so this may be tripping you up.
如果您转到此处< /a> 并阅读。
你会看到的。
现在,如果您查看 TextFormat 您会看到默认值几乎都是 0
我很久以前就遇到了这个问题,我发现的唯一解决方法是选择一些文本然后抓取 defaultTextFormat,然后取消选择文本。
我确信还有另一种方法可以做到这一点,但就像我说的,这是我的黑客攻击。
If you go here and read.
you will see.
Now if you look at TextFormat You will see the defaults are all pretty much 0
I ran into this issue a long time ago and the only work around I found was to select some text then grab defaultTextFormat and then deselect the text.
I am sure there is another method to do this but like I said it was my hack-a-round.