Skip to main content
Participant
May 9, 2024 7:05 AM UTC
Answered

createjs.Touch.enable(stage) - help)))

Hello))
I know that I have already asked something similar, but I was so tormented, but could not solve this problem.

And so, the touch for dragging an object still does not work for me. Doesn't work in sensor emulation in the browser, not on a real device))

I have already written - createjs.Touch.enable(stage) - Help) ;

But unsuccessfully(((
Help me understand my mistake, please)

 

var stage = new createjs.Stage("canvasId");
createjs.Touch.enable(stage);
var root = this;

this.ball.on("pressmove", moveBall );

function moveBall(e) {
	console.log ("pressmove") ;
	
		var p = stage.globalToLocal(e.stageX, e.stageY)
		e.currentTarget.x= p.x;
		e.currentTarget.y= p.y;
	
}

this.ball.on("pressup", dropBall);


function dropBall () {
	
	console.log ("pressup");
	
		root.ball.alpha=0.5;
	
	}

 

This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
May 9, 2024 1:40 PM UTC

delete that top line of code.

3 replies

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 9, 2024 1:40 PM UTC

delete that top line of code.

Translate
Participant
May 9, 2024 2:38 PM UTC

oo you are just a wonderful person)) Thank you. I would still like to understand why this line was interfering

Translate
kglad
Community Expert
Community Expert
May 9, 2024 2:40 PM UTC

you have two stages with that code

Translate