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

trigger event outside the animate file

Community Beginner ,
Apr 12, 2018 Apr 12, 2018

Hi

Rather new to animate cc so let me try and explain what I am trying to achieve.

I have html5 canvas file with a map in it. I would like it that when you click on the map apart from the animation that plays it will trigger an event on the webpage where its displayed so that the a java script on the site displays a text div.

I have the code for navigating the map working just fine. Its just the code for triggering an event outside the animate file. I dont know if that is possible to have the animate file trigger events outside the file itself and how would the code look like?

Thank you for all your inputs.

895
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

Community Expert , Apr 16, 2018 Apr 16, 2018

Hi.

What you can do is to dispatch an event and then set a HTML5 DOM element to listen to it.

Something like this:

window.dispatchEvent(new CustomEvent("eventname", {detail:{prop:"value"}}));

window.addEventListener("eventname", yourDisplayDivTextFunction.bind(this));

It can be the window itself, document... whatever you need.

Regards,

JC

Translate
Adobe Employee ,
Apr 16, 2018 Apr 16, 2018

Can you provide details on the purpose of such a trigger and what you are hoping to achieve?

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
Community Expert ,
Apr 16, 2018 Apr 16, 2018

Hi.

What you can do is to dispatch an event and then set a HTML5 DOM element to listen to it.

Something like this:

window.dispatchEvent(new CustomEvent("eventname", {detail:{prop:"value"}}));

window.addEventListener("eventname", yourDisplayDivTextFunction.bind(this));

It can be the window itself, document... whatever you need.

Regards,

JC

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
Community Beginner ,
Apr 25, 2018 Apr 25, 2018

Thank you so much was just what i was looking for.

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
Community Expert ,
Apr 25, 2018 Apr 25, 2018
LATEST

You're welcome!

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