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

Help for HTML5 code for a restart button (only reloading the actual frame not the whole document)

New Here ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Hello,

I am not much experienced with coding but managed to make simple drag and drop objects in various frames of a HTML5 Canvas document. I would like to add a restart button for each frame to place back objects (Movie Clips) to their original position. Not sure how to go from there !

 

Files available here:

http://www.violinopedia.com/TEST.zip

 

Thank you !

 

 

Code for objects is only:

 

object.on("mousedown", function(e)
{
e.currentTarget.offsetX = stage.mouseX / stage.scaleX - e.currentTarget.x;
e.currentTarget.offsetY = stage.mouseY / stage.scaleY - e.currentTarget.y;
});

object.on("pressmove", function(e)
{
e.currentTarget.x = stage.mouseX / stage.scaleX - e.currentTarget.offsetX;
e.currentTarget.y = stage.mouseY / stage.scaleY - e.currentTarget.offsetY;
});

Views

80

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 ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

LATEST

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