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

call function from main canvas inside a symbol

Community Beginner ,
Jun 21, 2017 Jun 21, 2017

Copy link to clipboard

Copied

Hi,

I'm a newbie with Animate CC and JavaScript, so bear with me if I use the wrong terms - I'll try to be as clear as possible.

Let's say we have the following function written on frame 1 of the main canvas:

this.exampleFunction = function (message) {

    console.log(message);

}

So I'm happy because I can call this function even when I'm on frame 100. But let's say I create a Symbol Definition - I double click something on my canvas, and I'm brought to this "new layer" where I can edit stuff. From here, I start adding code as well. Everything works, but I can't seem to call the function (exampleFunction) I made on frame 1.

How would I go on about doing this? Let me know if we need more info to tackle this problem!

Views

1.2K

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
community guidelines

correct answers 1 Correct answer

Adobe Employee , Jun 22, 2017 Jun 22, 2017

You can call it in two ways :-

this.parent.exampleFunction('message');

exportRoot.exampleFunction('message'); //exportRoot refers to the main timeline.

Votes

Translate

Translate
Adobe Employee ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

You can call it in two ways :-

this.parent.exampleFunction('message');

exportRoot.exampleFunction('message'); //exportRoot refers to the main timeline.

Votes

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
community guidelines
LEGEND ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

LATEST

byunghoona16325993  wrote

I'm a newbie with Animate CC and JavaScript, so bear with me if I use the wrong terms

There is no "main" canvas. There is only one canvas. You mean the main (or "root") timeline.

Going inside a symbol does not access a "new layer", it accesses a new timeline.

Votes

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
community guidelines