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

How to access the function in js file which is written in Animate CC time line

Explorer ,
Dec 08, 2016 Dec 08, 2016

Animate CC Timeline Function

this.testFunction = function () {

console.log("welcome to CC");

}

How to access "testFunction" in js file

433
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 08, 2016 Dec 08, 2016

Man, someone is marking correct answers on autopilot today.

To access any code written inside Animate from outside Animate, use the exportRoot object. This global object is automatically defined by Animate, and points to the root timeline level. So if you defined testFunction on the root timeline, you'd access it from anywhere else on the same HTML page with:

exportRoot.testFunction();

And if the function is inside a movieclip, you'd name the movieclip and extend the reference as per usual for Java

...
Translate
Community Expert ,
Dec 08, 2016 Dec 08, 2016

open your js file in a text editor.

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

Man, someone is marking correct answers on autopilot today.

To access any code written inside Animate from outside Animate, use the exportRoot object. This global object is automatically defined by Animate, and points to the root timeline level. So if you defined testFunction on the root timeline, you'd access it from anywhere else on the same HTML page with:

exportRoot.testFunction();

And if the function is inside a movieclip, you'd name the movieclip and extend the reference as per usual for JavaScript:

exportRoot.myMovieClip.testFunction();

etc...

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