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

Tactile problem

Explorer ,
Sep 04, 2020 Sep 04, 2020

Hello,
I have read almost all the articles in this forum about the touch function and I can't find a solution that works. I have the following code that doesn't work on tablets. Could someone please tell me where is my error? I'm new to HTML5 canvas.
Thanks in advance for any answer.

 

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

var m_X;
var m_Y;

this.movieClip.addEventListener("mousedown", maFonction.bind(this));

function maFonction(evt) {
var st = this.globalToLocal(evt.stageX, evt.stageY);
var c_X = st.x;
var c_Y = st.y;

var d_X = this.movieClip.x;
var d_Y = this.movieClip.y;

m_X = (d_X - c_X);
m_Y = (d_Y - c_Y);

}

this.movieClip.addEventListener("pressmove", maFonction2.bind(this));

function maFonction2(evt) {
var st = this.globalToLocal(evt.stageX, evt.stageY);
var c_X = st.x;
var c_Y = st.y;

var mt1 = m_X;
var mt2 = m_Y;

var z_X = Math.round(c_X + mt1);
var z_Y = Math.round(c_Y + mt2);

this.movieClip.x = z_X;
this.movieClip.y = z_Y;
stage.update(event);
};

 

210
Translate
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 ,
Sep 05, 2020 Sep 05, 2020

i don't see a code problem.  you should be able to drag and drop movieClip (though nothing happens when you drop).

 

what do you expect to occur that you fail to see?

Translate
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
Explorer ,
Sep 05, 2020 Sep 05, 2020

In fact, I just found out by publishing on the Internet that this code works. The problem came from the "adaptive view" of my browsers that don't work (which is necessarily annoying for the rest).
Thank you for your answer. The subject is closed.
(Unless you have an idea how to fix the browser's adaptive console, please ?).

Translate
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 ,
Sep 05, 2020 Sep 05, 2020
LATEST

you're welcome.

Translate
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