Copy link to clipboard
Copied
I'm trying to do a simple drag and drop using "pressmove." The problem I'm having is that the object being dragged is only centered on the mouse pointer when it is a 0, 0 on the stage. The further right I go, the more the object lags behind the cursor (object X < cursor X). The more down I go, the more the object lags in the Y direction. So, it is perfect in the upper left-hand corner and totally off (~100 px) in both dimensions in the lower right corner. What the heck?
var a17 = new lib.A17();
answer1Array.push(a17);
a17.addEventListener("pressmove", moveItem);
function moveItem (e){
e.currentTarget.x = e.stageX;
e.currentTarget.y = e.stageY;
}
try
function moveItem (e){
e.currentTarget.x = e.stageX/stage.scaleX;
e.currentTarget.y = e.stageY/stage.scaleY;
}
Copy link to clipboard
Copied
try
function moveItem (e){
e.currentTarget.x = e.stageX/stage.scaleX;
e.currentTarget.y = e.stageY/stage.scaleY;
}
Copy link to clipboard
Copied
Excellent!!! Thanks!!!
Copy link to clipboard
Copied
you're welcome.