Skip to main content
Participant
February 13, 2020
Question

html5 drag and drop

  • February 13, 2020
  • 1 reply
  • 184 views

All I need is just a simple drag and drop. To be honest I have no idea about html 5 😃

I have a movieclip, let's call it exampleClip or something.

And all I want to do is make drag and drop possible, no extras.

 

exampleClip.on("pressmove", function(evt) {
evt.target.x = evt.stageX;
evt.target.y = evt.stageY;
});

 

This I have found already, but in test it didn't work. Just played the gif.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 13, 2020

this.exampleClip.addEventListener('pressmove', drag_step1F.bind(this));
this.exampleClip.addEventListener('pressup', drop_step1F.bind(this));

 

function drag_step1F(e){
e.currentTarget.x = (e.stageX)/stage.scaleX ;
e.currentTarget.y = (e.stageY)/stage.scaleY;
stage.update();
}
function drop_step1F(e){

// do whatever

}