当前位置:编程学习 > 网站相关 >>

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

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

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

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

textfield.height = textfield.textHeight;

textfield.getCharBoundaries(index);

//还原回之前的高度

textfield.height=sourceHeight;


作者:chjh0540237
补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,