Skip to main content
Participant
May 9, 2024
Answered

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

  • May 9, 2024
  • 1 reply
  • 400 views

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 has been closed for replies.
Correct answer kglad

delete that top line of code.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 9, 2024

delete that top line of code.

Participant
May 9, 2024

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

kglad
Community Expert
Community Expert
May 9, 2024

you have two stages with that code