Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

html5 drag and drop

New Here ,
Feb 13, 2020 Feb 13, 2020

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.

TOPICS
Code , How to
166
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2020 Feb 13, 2020
LATEST

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

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines