有帮助?打赏吧!

FLASH CC 2015 CANVAS 中 createjs 移除绑定事件

 

myBtn.addEventListener("click", function(evt) {
        // do stuff...
        evt.remove(); // removes this listener.
    });

 

 

var S=this
S.btn.addEventListener("mousedown",function frame0Click(e) { S.btn.removeEventListener("mousedown",frame0Click) })

 

var name=this.on("mousedown",downF.bind(this))
this.removeF=function()
{
  this.off("mousedown",name)
}

 

 

 

在移动端,你需要在页面中增加一句

 createjs.Touch.enable(stage);

然后 mousedown 就能启到 touchstart的效果!

 

PS:JS中尤其需要注意 函数 变量的作用域,以及this的指代

 

posted @ 2015-08-11 16:48  luoeeyang  Views(1032)  Comments(2)    收藏  举报