0
我有,我想删除EventListener
的功能,但它给了我下面的错误:删除事件侦听器3
Access of undefined property event
这里是有问题的代码:
dr_line.addEventListener(MouseEvent.CLICK,drawln);
var test:Boolean;
function drawln(e:MouseEvent):void{
event.currentTarget.removeEventListener(MouseEvent.CLICK, drawln);
stage.addEventListener(MouseEvent.CLICK,click1);
}
var sx,sy,fx,fy,j:int;
function click1(e:MouseEvent):void{
sx=mouseX;
sy=mouseY;
stage.addEventListener(MouseEvent.CLICK,click2);
}
function click2(e:MouseEvent):void{
var i:int;
i=1;
trace(i);
fx=mouseX;
fy=mouseY;
var line:Shape = new Shape();
line.graphics.beginFill(0x00FF00);
line.graphics.moveTo(sx,sy);
line.graphics.lineTo(fx,fy);
this.addChild(line);
}
我试着去除click1
和click2
中的事件监听器,但它仍然没有工作。
我在做什么错?