Using touch events with Createjs / Easeljs

Cod1ngFree picture Cod1ngFree · Jun 18, 2013 · Viewed 12.9k times · Source

I'm trying to use touch events with Createjs / Easeljs objects. For example, I'm trying to attach a touchstart and touchmove event using addEventListener.

Touchstart and mousedown seems to work: I'm using a browser and a touch device to test it and it seems to work in both cases.

However, mousemove and touchmove doesn't seem to work. I though it was because I removed the stopPropagation and preventDefault methods, but I saw that Lanny McNie wrote that there is no need to do it in CreateJS 1.

I can't figure out why it doesn't work.

This is my code: http://pastebin.com/pqxWLNKG

Regards.

Answer

Lanny picture Lanny · Jun 18, 2013

You can use the Touch class included with EaselJS to enable multi-touch - which translate into normal EaselJS mousedown/mousemove events. Check out the DragAndDrop demo: http://www.createjs.com/demos/easeljs/draganddrop

createjs.Touch.enable(stage);

Cheers.