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

HTML5 - "Play" button works but "Replay" doesn't

Community Beginner ,
Nov 03, 2016 Nov 03, 2016

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

}

845
Translate
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

correct answers 1 Correct answer

Advocate , Nov 08, 2016 Nov 08, 2016

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.

Translate
Advocate ,
Nov 03, 2016 Nov 03, 2016

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.

Translate
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 Beginner ,
Nov 08, 2016 Nov 08, 2016

Yep, the button appears to have the appropriate instance name....

Does this help?

http://valtoukatly.com/BeaconSt_WIP/beaconst.fla.zip

Translate
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
Advocate ,
Nov 08, 2016 Nov 08, 2016

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.

Translate
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 Beginner ,
Nov 09, 2016 Nov 09, 2016
LATEST

That solved it! Thanks so much.

Translate
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