Skip to main content
Participant
March 14, 2025
Question

Help! Trying to Learn Drag and Drop on Animate HTML5 Canvas, Need Guidance!

  • March 14, 2025
  • 1 reply
  • 141 views

Hello! 🙏 I’m really interested in creating drag and drop functionality on Adobe Animate HTML5 Canvas and would appreciate some guidance from those with more experience. I’m still a beginner and have tried several times, but I’m struggling to even get the basic object dragging to work. 😅 If anyone has any tips or advice, it would be greatly appreciated! Thank you so much!

1 reply

kglad
Community Expert
Community Expert
March 14, 2025
puzzlepieces[i].addEventListener("pressmove", startDrag);
puzzlepieces[i].addEventListener("pressup", stopDragF.bind(this));
 
 
function startDragF(e){
var p = stage.globalToLocal(e.stageX, e.stageY);
    e.currentTarget.x = p.x;
    e.currentTarget.y = p.y
}
 
function stopDragF(e){
e.currentTarget.removeEventListener("pressdown", startDrag);
}