Search code examples
mobilecreatejseaseljsmousemove

Mousemove events not firing on mobile with create.js


For my application, I need continous updates of the user's touch/mouse position, but I can't seem to get pressmove events firing on mobile devices with easeljs-0.8.1.min.js

I've enabled Touch on the stage with

createjs.Touch.enable(stage, true, false);

and testing with

stage.addEventListener("pressmove", function (evt) {
    console.log("stage pressmove");
});

works on desktops, but gives no results on Android Chrome and iOS Chrome.

What could be wrong?


Solution

  • The stage will not dispatch a pressmove event. That event is only fired by displayObjects that live on the stage. You can use the stagemousemove event instead, which is always fired, no matter what us under the mouse on the stage.

    stage.addEventListener("stagemousemove", function (evt) {
        console.log("stagemousemove");
    });
    

    http://www.createjs.com/docs/easeljs/classes/Stage.html#event_stagemousemove