首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

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

2012-08-25 
AS3 textfield.getCharBoundaries(index) 有时会返回NULL的问题解决方案我在使用TextField.getCharBoundar

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

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

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

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

textfield.height = textfield.textHeight;

textfield.getCharBoundaries(index);

//还原回之前的高度

textfield.height=sourceHeight;

热点排行