Tactile problem
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);
};
