import flash.ui.Mouse;
import flash.events.Event;
import flash.events.MouseEvent;
//MOUSE_LEAVE事件用来检测鼠标是否离开影片
stage.addEventListener(Event.MOUSE_LEAVE,mcHide);
//当鼠标进入影片时MOUSE_MOVE事件来检测,因为MOUSE_MOVE事件只有在鼠标存在于影片范围内时触发
stage.addEventListener(MouseEvent.MOUSE_MOVE,mcFollow);
MOuse.hide();
function mcHide(e:EVENT):void
{
mc.visible = false;
}
function mcFollow(e:MouseEvent):void
{
//如果mc不可见
if(!mc.visible)
{
//显示mc
mc.visible = true;
}
mc.x = mouseX;
mc.y = mouseY;
}