Copy link to clipboard
Copied
Hi,
I'm new to using Adobe Animate/HTML5 Canvas and help with this would be much appreciated!
Essentially I have a short animation that I want to start when the user hits a "PLAY" button, and at the end has the option to "REPLAY."
The initial play button works great, but for some reason I can't get the replay to work.
Here's the actions I have for PLAY:
this.stop();
this.Play1.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_2.bind(this));
function fl_ClickToGoToAndPlayFromFrame_2()
{
this.gotoAndPlay(2);
}
And what I have for REPLAY:
this.Replay2.addEventListener("click", fl_MouseClickHandler.bind(this));
function fl_MouseClickHandler()
{
this.gotoAndPlay(2);
}
If you update it so that the instance name is present on every keyframe where the button appears, that should fix it. Currently the instance name is only on the final keyframe.
Copy link to clipboard
Copied
That code should work fine. Did you give your replay button an instance name of Replay2?
If instance names aren't the issue, please share a copy of your FLA to make troubleshooting easier.
Copy link to clipboard
Copied
Yep, the button appears to have the appropriate instance name....
Does this help?
Copy link to clipboard
Copied
If you update it so that the instance name is present on every keyframe where the button appears, that should fix it. Currently the instance name is only on the final keyframe.
Copy link to clipboard
Copied
That solved it! Thanks so much.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now