Very slow HTML5 movement.
Hello,
I am a great beginner in Animate HTML5, I use the following code to move, with the mouse, an object named "myClip". This code works very well and also allows not to center the mouse on the object to move:
this.myClip.addEventListener("mousedown", fctIA.bind(this));
function fctIA(evt)
{
var pm = this.globalToLocal(evt.stageX, evt.stageY);
differenceX = (this.myClip.x - pm.x);
differenceY = (this.myClip.y - pm.y);
}
this.myClip.on("pressmove", fctIB.bind(this));
function fctIB(evt)
{
var pm = this.globalToLocal(evt.stageX, evt.stageY);
this.myClip.x = (pm.x + differenceX);
this.myClip.y = (pm.y + differenceY);
stage.update();
}
On the other hand, when several layers and clips are present, the movement of myClip becomes very slow: a delay of a few seconds occurs when I try to make a movement.
What is my mistake? How can I fix it?
Thanks to everyone who can help me.
Translated with www.DeepL.com/Translator (free version)
