标签跟随鼠标移动

/*
建mc1放在舞台 mc2放在库中
*/


import flash.events.MouseEvent;

var mc2:Mc2;

mc1.addEventListener(MouseEvent.ROLL_OVER,mc1OverHandler);
mc1.addEventListener(MouseEvent.ROLL_OUT,mc1OutHandler);
function mc1OverHandler(e:MouseEvent):void
{
	mc2 = new Mc2  ;
	mc2.x = mouseX;
	mc2.y = mouseY;
	addChild(mc2);
	stage.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
}

function moveHandler(e:MouseEvent):void
{
	mc2.x = mouseX;
	mc2.y = mouseY;
}

function mc1OutHandler(e:MouseEvent):void
{
	stage.removeEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
	removeChild(mc2);
}
原文地址:https://www.cnblogs.com/602147629/p/1922289.html