首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

Flex TextInput tooltip 当超过组件长度时展示

2012-09-10 
Flex TextInput tooltip 当超过组件长度时显示如标题所说,直接上代码protected function changeHandler(ev

Flex TextInput tooltip 当超过组件长度时显示

如标题所说,直接上代码

protected function changeHandler(event:TextOperationEvent){//通过UIComponent的measureText方法得到TextLineMetrics,它的width就能得到输入框字符所占的真实widthvar charsWidth:int = txtInput.measureText(txtInput.text).width;if (charsWidth > txtInput.width) //与textinput的width进行比较{txtInput.toolTip = txtInput.text;}else{txtInput.toolTip = "";}}<s:TextInput id="txtInput" change="changeHandler(event)"/>
?

热点排行