function mOver(evt:MouseEvent):void{
myTextArea = evt.target as TextArea;
var lineHeight:Number;
if(myTextArea.getLineMetrics(0)!=null)
lineHeight = myTextArea.getLineMetrics( 0 ).height;
mChars = Math.ceil(myTextArea.length);
var textHeight:Number = myTextArea.textHeight;
numLines = Math.ceil( textHeight/lineHeight );
//overLine = myTextArea.getLineMetrics(mouseLine) as String;
vScrollPos = myTextArea.verticalScrollPosition;
mouseLine = Math.ceil( (myTextArea.mouseY )/lineHeight + myTextArea.verticalScrollPosition);
var tf:TextField = myTextArea.mx_internal::getTextField();
if((mouseLine>=1) && (mouseLine<=numLines))
overLine = tf.getLineText(mouseLine-1);
if(overLine.indexOf("tooltip") != -1)
myTextArea.toolTip = "这个是ToolTip";
else
myTextArea.toolTip = "";
//trace("lineHeight="+lineHeight);
}
TextArea mouseover 实现特定行 tooltip
最新推荐文章于 2022-08-04 15:47:05 发布