cocos2d-js android devices don't respond to touch events, iOS and web does work with touch events

345 Views Asked by At

I am using cocos2D-JS to port my 2D game to multiple platforms.

The problem I am having is whenever I run and test the game on an android device, it won't respond to touch events at all. With the exact same code, I can build and run it on iOS devices and the touch works. When I run it on the web, touch events work fine with iOS or android devices.

This is how I am implementing my touch events: --------------

with in the main gameScene

(cc.Scene.extent({

onEnter: function(){
...
...
...

cc.eventManager.addListener({

    event: cc.EventListener.TOUCH_ONE_BY_ONE,
    setTouchEnabled: true,

    onTouchBegan: function(touch,event){
        // Do Stuff
        // Do More Stuff
    },
    .....
    .....
},this);

Like I said iOS and web is responding just fine to these touch events, just android devices are not. Also mouse events are working fine on all platforms.

Any ideas? Thank You

1

There are 1 best solutions below

0
On

There is a typo: you should use extend from cc.Scene.