Highlighted

Animate CC canvas : external JS call function

Community Beginner ,
Feb 26, 2019

Copy link to clipboard

Copied

Hello. It's been several days that I search on the net but not finding the solution, I decide to ask it here.

I'm loading a .js file into my Animate CC (Canvas) file.

Since the timeline I can start a function that is in the .js. But the opposite does not work. I have either the message "is not a function" or "undefined function".

How to communicate between the .js and my timeline?

Thanks for your help

Thanks for your help.

I found another solution that works (thanks to 😞

canvasTimeline = this;

I create a global variable that points to the main timeline of my canvas project. I now access everything in my canvas via my global variable since my .js

I was trying to make it complicated when it was very simple;)

Views

907

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Animate CC canvas : external JS call function

Community Beginner ,
Feb 26, 2019

Copy link to clipboard

Copied

Hello. It's been several days that I search on the net but not finding the solution, I decide to ask it here.

I'm loading a .js file into my Animate CC (Canvas) file.

Since the timeline I can start a function that is in the .js. But the opposite does not work. I have either the message "is not a function" or "undefined function".

How to communicate between the .js and my timeline?

Thanks for your help

Thanks for your help.

I found another solution that works (thanks to 😞

canvasTimeline = this;

I create a global variable that points to the main timeline of my canvas project. I now access everything in my canvas via my global variable since my .js

I was trying to make it complicated when it was very simple;)

Views

908

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 26, 2019 0
Adobe Community Professional ,
Feb 26, 2019

Copy link to clipboard

Copied

Hi.

There are at least two ways of doing this:

- Use exportRoot, which is a global reference to the main timeline created by the Animate CC exporter;

- Pass the main timeline as an argument when instantiating your class.

For example:

var player = new Player(this);

Regards,

JC

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2019 0
Community Beginner ,
Feb 26, 2019

Copy link to clipboard

Copied

Thanks for your help.

I found another solution that works (thanks to 😞

canvasTimeline = this;

I create a global variable that points to the main timeline of my canvas project. I now access everything in my canvas via my global variable since my .js

I was trying to make it complicated when it was very simple;)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2019 0
Adobe Community Professional ,
Feb 26, 2019

Copy link to clipboard

Copied

Nice.

You can do this as well, but I it's redundant because you already have a global reference to the main timeline (exportRoot).

Regards,

JC

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2019 0