Highlighted

Animate HTML5. How do I call a function written on a library symbol?

Community Beginner ,
Jan 05, 2019

Copy link to clipboard

Copied

Animate HTML5. I have a library symbol and an instance of it on the parent. The symbol contains a JS function. How do I call the function from a script on the parent?.  Symbols on AS3 have an option “export for ActionScript” .  I do not find anything similar on HTML5 symbols.

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

The same way you access anything else in Animate. If your instance is named "foo" and your function is named "bar" just do:

this.foo.bar();

Of course, this only works if your function is defined as a method of the instance:

this.bar = function() {

     // bla bla bla

}

Views

141

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 HTML5. How do I call a function written on a library symbol?

Community Beginner ,
Jan 05, 2019

Copy link to clipboard

Copied

Animate HTML5. I have a library symbol and an instance of it on the parent. The symbol contains a JS function. How do I call the function from a script on the parent?.  Symbols on AS3 have an option “export for ActionScript” .  I do not find anything similar on HTML5 symbols.

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

The same way you access anything else in Animate. If your instance is named "foo" and your function is named "bar" just do:

this.foo.bar();

Of course, this only works if your function is defined as a method of the instance:

this.bar = function() {

     // bla bla bla

}

Views

142

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
Jan 05, 2019 0
Adobe Community Professional ,
Jan 05, 2019

Copy link to clipboard

Copied

The same way you access anything else in Animate. If your instance is named "foo" and your function is named "bar" just do:

this.foo.bar();

Of course, this only works if your function is defined as a method of the instance:

this.bar = function() {

     // bla bla bla

}

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...
Jan 05, 2019 0
Community Beginner ,
Jan 06, 2019

Copy link to clipboard

Copied

Thank you for your help. Problem solved.

I followed your instructions and found out that the instance function can not be called while the page is loading. I moved the calling to frame 20 and it worked fine.

I understand you get points on this help. How should I proceed for you getting them?

Enviado desde Correo<https://go.microsoft.com/fwlink/?LinkId=550986> para Windows 10

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...
Jan 06, 2019 0
Adobe Community Professional ,
Jan 06, 2019

Copy link to clipboard

Copied

Just click the button under whichever post you think is the correct answer.

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...
Jan 06, 2019 0
Community Beginner ,
Jan 07, 2019

Copy link to clipboard

Copied

Sorry, the Correct Answer button does not show on my screen. All our transactions are there but the button or something similar. The reason may be that I am in Argentina. This happened to me before and would like to correct it. A sugestion?

Enviado desde Correo<https://go.microsoft.com/fwlink/?LinkId=550986> para Windows 10

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...
Jan 07, 2019 0
Adobe Community Professional ,
Jan 07, 2019

Copy link to clipboard

Copied

Hi.

I marked Clay's answer as the correct one for you.

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...
Jan 07, 2019 0