html5 - createjs实例化的对象怎么绑定touch事件,用createjs自己的方法监听不起作用
大家讲道理
大家讲道理 2017-04-17 11:14:08
0
4
517

javascript createjs

//代码片段,能看懂就行
createjs.Touch.enable(stage,true,false); 
//让createjs可以使用touch


//方法1
//绑定click
instance.addEventListener("click",handleClick);
//handleClick正常执行

//绑定touch
instance.addEventListener('touchstart', handleTouch);
//handleTouch不执行


//方法2
//click
instance.on("click", function(){        
    console.log(111);
});  //console的111可以显示
//touch
instance.on("touchstart", function(){       
    console.log(111);
});  //console的111无法显示

在学习使用createjs,不清楚是哪儿的问题,希望指出来,有建议最好,谢谢

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

répondre à tous(4)
伊谢尔伦

启用 touch 后,使用 mousedown 替换 touchstart 试试。

http://www.createjs.com/Docs/EaselJS/classes/Touch.html

Peter_Zhu

我也遇到了跟你同样的问题不知道楼主现在解决了没,困扰我很久了求解决方法

PHPzhong

楼主参考这个移动设备拖拽的实现代码吧: http://www.gbtags.com/gb/rtreplayerpreview/500.htm

刘奇

他是公用的mouse事件的 你直接写好pressup pressdown pressmove事件 然后开启触摸事件就可以。
开始触摸事件是这个
createjs.Touch.enable(stage);

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!