Copy link to clipboard
Copied
Hello, does anyone know how to make the touch screen react to pressing an object? ? )) Here is the function for the mouse and desktop on primer (in Adobe Animated) - this.ball.on("pressmove", moveBall ); . But it doesn't work on a mobile screen. Is there an alternative? Just not a click, but a constant click on an object is read
There isn't any specifically for mobile, as far as I can tell.
But the official documentation for CreateJS is at createjs.com.
Copy link to clipboard
Copied
i don't see a problem.
Copy link to clipboard
Copied
I'm sorry. Attached - fla and example code.
I repeat. Everything works fine on a desktop with mouse controls, but does not work on a mobile device with a touch screen. Can you tell me what to do?
var root = this;
this.yes.visible=false;
this.ball.on("pressmove", moveBall );
function moveBall(e) {
var p = stage.globalToLocal(e.stageX, e.stageY)
e.currentTarget.x= p.x;
e.currentTarget.y= p.y;
}
this.ball.on("pressup", dropBall);
var myN=0;
function dropBall () {
if(root.ball.x>85 && root.ball.x < 1180 && root.ball.y > 65 && root.ball.y < 365 ) {
root.ball.alpha=0.5;
root.ball.x=root.myRect.x;
root.ball.y=root.myRect.y;
root.yes.visible=true;
myN++
if(myN>5) {
root.ball.visible=false;
}
} else {
root.ball.alpha=1;
root.yes.visible=false;
}
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi.
Please make sure you're enabling touch interactions by calling...
createjs.Touch.enable(stage);
... in the beginning of your code.
Regards,
JC
Copy link to clipboard
Copied
Thank you. Please tell me, is there a link to the documentation that describes all the commands when working with canvas on a touch screen?
Copy link to clipboard
Copied
There isn't any specifically for mobile, as far as I can tell.
But the official documentation for CreateJS is at createjs.com.
Copy link to clipboard
Copied
https://createjs.com/demos/easeljs/draganddrop
Thanks for the link. I found an example at the link, but even here, if you emulate a mobile device, then nothing works. Tell me, is this example with flowers really possible to do on a touch screen?
Copy link to clipboard
Copied
thanks it worked)
Copy link to clipboard
Copied
also, you may need
e.currentTarget.x= p.x/stage.scaleX;
e.currentTarget.y= p.y/stage.scaleY;