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

32

Likes

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

Copy link to clipboard

Copied

LATEST

try this tutorial. https://www.youtube.com/watch?v=JYBWehkks_Y


Multimedia Developer, Character Creator, and Animator.

Likes

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