现在的位置: 首页 > 综合 > 正文

AS3 textfield.getCharBoundaries(index) 有时会返回NULL的问题解决方案

2013年09月15日 ⁄ 综合 ⁄ 共 276字 ⁄ 字号 评论关闭

我在使用TextField.getCharBoundaries(index)方法时,发现在htmlText赋值后,有时会得到NULL值,经一翻搜索询问,发现下面方法可以解决此问题

在使用此方法前需重新设置下文本高度,如下:

sourceHeight = textfield.height;        //保存原高度,用于后面还原回来

textfield.height = textfield.textHeight;

textfield.getCharBoundaries(index);

//还原回之前的高度

textfield.height=sourceHeight;

抱歉!评论已关闭.