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

html5 drag and drop

New Here ,
Feb 13, 2020 Feb 13, 2020

Copy link to clipboard

Copied

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

Views

124

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

}

Votes

Translate

Translate

Report

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