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

Communication from HTML to Animate CC (HTML5 canvas)

Enthusiast ,
Feb 24, 2017 Feb 24, 2017

Hi all,

Say we have a table of contents HTML page. If each chapter is a different HTML page with a number of anchored sections, the table of contents will list anchor links like <a href="chapitre_3.html#section5-2">.

Now let us suppose that a chapter is an Animate CC timeline with a number of labelled sections  ("section5-2" for example). Is there a way I could pass parameter "section5-2" from the table of contents HTML page, so that after loading the correct HTML page containing the HTML5 canvas publishing of the chapter, I could run a this.gotoAndStop("section5-2") ? Any ideas ? Thanks in advance

803
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
LEGEND ,
Feb 24, 2017 Feb 24, 2017

Try reading window.location, to see if it includes the anchor part. If it does you could use window.location.split( "#" ); to get an array, probably of length 2. Which means this single line might work:

this.gotoAndStop(window.location.split( "#" )[1]);

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
Enthusiast ,
Feb 27, 2017 Feb 27, 2017

Thank you very much, Colin. It works like a charm adding a toString() call (code on frame 1) :

var section = window.location.toString().split( "#" )[1];

Strangely, though frame 1 is indeed labelled section3-1, calling this.gotoAndStop( section) when (section == "section3-1") produces an empty canvas ! So I need the following test (or leaving anchor #section3-1 for the first link) :

if (section == "section3-1")

{

  this.stop();

}

else

{

  this.gotoAndStop( section);

}

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
LEGEND ,
Feb 27, 2017 Feb 27, 2017
LATEST

I have seen similar issues. It seems that telling CreateJS to gotoAndStop to the frame it's already on can cause problems.

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