我正在尝试让对象在 as3 中跟随鼠标。我的愿望是,当我翻过一个movieclip(btn1) 时,我希望使对象跟随鼠标(my_object) 的函数停止,直到我滚出它为止。这是脚本:
btn1.addEventListener(MouseEvent.ROLL_OVER, JD);
function JD(event:MouseEvent):void{
stage.removeEventListener(Event.ENTER_FRAME, follow_me);
}
btn1.addEventListener(MouseEvent.ROLL_OUT, kk);
function kk(event:MouseEvent):void{
play();
}
stage.addEventListener(Event.ENTER_FRAME,follow_me)
function follow_me(event:Event):void {
var dx:int = bracketL.x - mouseX;
var dy:int = bracketL.y - mouseY;
my_object.x -= dx / 9+5;
my_object.y -= dy /9;
}
即使我翻过 btn1,my_object 也没有停止,它仍然跟随鼠标!!我应该怎么办 ?