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

External Playing/Stoping the Canvas

New Here ,
Dec 02, 2016 Dec 02, 2016

Hi there !

I have an HTML project that loads HTML's generated through Animate.

I need a way, from my "container" page, to stop and play the "main timeline" of the Animate generated page. It would be just as if I called the "this.stop()" or "this.play()", but from my container, through Javascript.

I tried a loooot of the "easy" things, including passing as a parameter a function that would call the "this.stop()" from inside the Animate code.

The Animate code easily calls functions from my external Javascript, but I couldn't, for the life of me, call the Animate functions from my JS.

Thanks all ! 

1.5K
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

LEGEND , Dec 02, 2016 Dec 02, 2016

This has been asked a few times. There's literally no difference between JavaScript coded inside Animate and JavaScript anywhere else in the same HTML document, so all you need is the right object reference. Conveniently, Animate defines a global reference to the root timeline, exportRoot. You can prove its validity by dropping this code in your root timeline:

alert(exportRoot === this);

If you get "true"—which you should—then you're golden. So all you have to do to control the main timeline is:

ex

...
Translate
Community Expert ,
Dec 02, 2016 Dec 02, 2016

open your .js file in a text editor and edit it to do what you want.

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 ,
Dec 02, 2016 Dec 02, 2016
LATEST

This has been asked a few times. There's literally no difference between JavaScript coded inside Animate and JavaScript anywhere else in the same HTML document, so all you need is the right object reference. Conveniently, Animate defines a global reference to the root timeline, exportRoot. You can prove its validity by dropping this code in your root timeline:

alert(exportRoot === this);

If you get "true"—which you should—then you're golden. So all you have to do to control the main timeline is:

exportRoot.stop();

exportRoot.play();

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