如标题所说,直接上代码
protected function changeHandler(event:TextOperationEvent){
//通过UIComponent的measureText方法得到TextLineMetrics,它的width就能得到输入框字符所占的真实width
var 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)"/>