读书人

AS3 textfield.getCharBoundaries(ind

发布时间: 2012-08-25 10:06:20 作者: rapoo

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

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

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

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

textfield.height = textfield.textHeight;

textfield.getCharBoundaries(index);

//还原回之前的高度

textfield.height=sourceHeight;

读书人网 >Web前端

热点推荐