Skip to main content
Participant
March 2, 2021
Question

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

  • March 2, 2021
  • 1 reply
  • 149 views

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;
});

    This topic has been closed for replies.

    1 reply

    Community Expert
    March 3, 2021