• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
May 09, 2024 May 09, 2024

Copy link to clipboard

Copied

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;
	
	}

 

TOPICS
Code

Views

81

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 09, 2024 May 09, 2024

delete that top line of code.

Votes

Translate

Translate
Community Expert ,
May 09, 2024 May 09, 2024

Copy link to clipboard

Copied

delete that top line of code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 09, 2024 May 09, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 09, 2024 May 09, 2024

Copy link to clipboard

Copied

LATEST

you have two stages with that code

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines