Traced from the movement of a clip
Hello,
As a beginner in HTML5, I want to draw a line from the movement of a circle. I tried the following code that doesn't work. Can you please tell me where my error is?
this.circle.addEventListener("mousedown", fctFrt.bind(this));
function fctFrt(evt){
var pm = this.globalToLocal(evt.stageX, evt.stageY);
differenceX = (this.circle.x - pm.x);
differenceY = (this.circle.y - pm.y);
};
this.circle.on("pressmove", fctFrt39.bind(this));
function fctFrt39(evt){
var pm = this.globalToLocal(evt.stageX, evt.stageY);
this.circle.x = (pm.x + differenceX);
this.circle.y = (pm.y + differenceY);
var g = new createjs.Graphics() ;
stage.addChild(g) ;
g.setStrokeStyle(1);
g.beginStroke("#000000");
g.beginFill("red");
g.moveTo(this.circle.x , this.circle.y);
g.lineTo (this.circle.x,this.circle.y);
stage.update() ;
};
Thank you in advance for any answer.
