Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

cocos2d-js 多点触控事件绑定不上怎么解决啊,求大神指导下,代码如下

$
0
0

@981473253 写道:

 if('touches' in cc.sys.capabilities)
    {
        var self = this;
        cc.log("创建多点触控事件");
        var listener = cc.EventListener.create({
            event : cc.EventListener.TOUCH_ALL_AT_ONCE,
            onTouchesBegan : self.onTouchBegan.bind(self),
            onTouchesMoved : self.onTouchMoved.bind(self),
            onTouchesEnded : self.onTouchEnded.bind(self)

        });
        cc.log("成功创建多点触控事件并且添加给当前页");
        cc.eventManager.addListener(listener,self);
        cc.log("成功添加给当前页");

    }
    else
    {
        cc.log("当前设备不支持多点触控")
    }
},
onTouchBegan:function(touches,event)
{
    cc.log("多点事件添加完成");
    return true;
},
onTouchMoved:function(touches,event)
{
    cc.log("多点触摸成功触发");
},
onTouchEnded:function(touches,event)
{
    cc.log("多点触摸已结束");
},

事件可以成功的创建但是Began事件死活都触发不了

帖子: 1

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>