Disable multi touch in cocos html

Disable multi touch in cocos html
0.0 0


I have seen a different problem in my game when i tried on ipad.
I have a sprite and there is drag and drop event done using ontouchesbegan and ontouchesmoved events.When i use my single finger to drag ts working fine but when iam using one finger to drag and another finger on the screen the sprite gets stucked.
I think its a problem with multi touch.
Is there a way to disable multi touches in html library?
Is there a way to detect number of touches?
for eg:
} else
//write the game code


Hi, Abhiram

Cocos2d-html5 do support multitouch event, you can check out EventTest -> TouchOneByOneTest and TouchAllAtOnce in test case.

// TouchOneByOne Mode
onTouchBegan:function(touch, event) {
    // Only one touch each event call with the touch id
    var pos = touch.getLocation();
    var id = touch.getId();
    cc.log("onTouchBegan at: " + pos.x + " " + pos.y + " Id:" + id );
    return false;
// TouchAllAtOnce Mode
onTouchesBegan:function(touches, event) {
    // All active touches can be handled
    for (var i=0; i < touches.length;i++ ) {
        var touch = touches[i];
        var pos = touch.getLocation();
        var id = touch.getId();
        cc.log("Touch #" + i + ". onTouchesBegan at: " + pos.x + " " + pos.y + " Id:" + id);



Check out this : http://cocos2d-x.org/npm/cctouch/index.html
It’s our new online test case, it may be easier to understand.
And if have any suggest or feed back for the online test case, please let me know.