Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142382

Touch.enable not working in CreateJS through Animate CC

$
0
0

I've created an html5 canvas file in Animate CC and I can't seem to get it to respond to touches when run on a touch screen device. I've created a stripped down file to demonstrate the issue.

Every other post I've found online has been resolved with createjs.Touch.enable(stage), however, this doesn't enable touch for me (and it returns false). I've also included adding a touchstart event listener but this doesn't help either.

To debug in the console I'm using chrome in device emulation mode.

Results from the example code below:

  • Enabling touch returns false (So this is likely the issue)
  • pressing the mouse button returns "mouse down" and shifts ball.
  • pressing a touch does nothing
  • releasing the touch returns "mouse down" and shifts ball.

Any idea where I'm going wrong? Animate CC is completely up to date and createJS is v1.0.0

Expected behaviour is that the touchstart or mousedown handler is fired when the touch starts just like when using a mouse.

console.log("Enable touch: "+createjs.Touch.enable(stage) );  // returns false

ball = this.ball_mc;

// mouse mouse event
ball.on("mousedown", function(event) {
    console.log("mouse down");
    ball.x += 10;
});

// finger down event
ball.addEventListener("touchstart", function mouseDownHandler(e) {
    console.log("finger down");
    ball.x += 10;
});

Thanks in advance! - you'll be a lifesaver if you know what's going on or a workaround!

Dale.


Viewing all articles
Browse latest Browse all 142382

Trending Articles



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