Skip to main content
Known Participant
November 30, 2016
Answered

multi-touch or multitouch examples for html5 canvas using adobe animate cc

  • November 30, 2016
  • 2 replies
  • 3267 views

Using adobe animate html5 canvas, how can we use multitouch on and verify that 2 hit areas or buttons have been touched?

Using adobe animate html5 canvas, how can we use multitouch and know that there are multiple fingers on screen or canvas?

using adobe animate html5 canvas, how can we use multitouch to pinch zoom, pan, etc?

where can we find information about all multitouch examples or data that can help with this issue? (like maybe an API)

any examples here I believe will help lots of people because I have not seen this anywhere in forum.

Thanks !

This topic has been closed for replies.
Correct answer kglad

yeah but a simple example on how  we can use multitouch and verify that 2 hit areas or buttons have been touched will go a long way!


this is general multitouch code but if you just want to know if 2 buttons have been pressed, there are easier ways:

var touchObj = {};

var terminateLoop;

createjs.Touch.enable(stage);

this.b.addEventListener('mousedown',downF.bind(this));

this.b.addEventListener('pressup',upF.bind(this));

function downF(e){

if(!touchObj[e.pointerID]){

touchObj[e.pointerID]=[e.localX,e.localY];

}

if(!this.b.hasEventListener('pressmove')){

this.b.addEventListener('pressmove',moveF.bind(this));

}

}

function upF(e){

delete touchObj[e.pointerID];

terminateLoop = true;

for(var s in touchObj){

terminateLoop = false;

break

}

if(terminateLoop){

this.b.removeEventListener('pressmove',moveF.bind(this));

}

this.tf.text += 'up\n'

}

function moveF(e){

// do whatever with e.localX,e.localY and touchObj[e.pointerID][0],touchObj[e.pointerID][1]

}

2 replies

jramerizAuthor
Known Participant
December 1, 2016

Wow! Nice! thanks! I will post my working examples when i get a chance incase someone needs them!

kglad​ thank you for you help!

kglad
Community Expert
Community Expert
December 1, 2016

you're welcome.

kglad
Community Expert
Community Expert
November 30, 2016

enable touch events on your stage.

touch events are then converted to mouse events and you can use listeners to encode whatever your want.  each mouse event has a pointerID that you can use to control multitouch events like pinch/zoom.

EaselJS v0.8.2 API Documentation : Touch

jramerizAuthor
Known Participant
November 30, 2016

Yeah, i get that there's touch documentation but is there any examples?

Legend
November 30, 2016

Did you try reading the documentation?