Skip to main content
Participant
October 26, 2017
Answered

Animate CC - GotoAndPlay from Jquery External

  • October 26, 2017
  • 1 reply
  • 1615 views

Hi,

I'm having a simple problem, yet i can't find any solution to this...

So I've 4 Animated MovieClips that loops in a Frame 0 (Stopped).

1. What i need to do?

When the User clicks a Button in HTML(not in Animate CC) - which is in the HTML page i've created, I want the Animation in Canvas(animate cc) to gotoAndPlay.

2. Problem

I couldn't figure a way to call a function or gotoAndPlay from External Jquery/Javascript to do this...

Please Help, it would be awesome if HTML elements can trigger functions inside the Actionscript or Functions in ANIMATE CC

---

Please HELP!!! - i Know this is possible and just don't know how...

Thanks a lot,

Prabu

    This topic has been closed for replies.
    Correct answer ClayUUID

    Just put this line in the first frame of your Animate movie:

    window.myMovie = this;

    With that reference, any external code can control things as if it was executing inside Animate.

    window.myMovie.ohGodItsAGiantTacoThatWillDestroyUsAll.gotoAndPlay(1);

    1 reply

    ClayUUIDCorrect answer
    Legend
    October 26, 2017

    Just put this line in the first frame of your Animate movie:

    window.myMovie = this;

    With that reference, any external code can control things as if it was executing inside Animate.

    window.myMovie.ohGodItsAGiantTacoThatWillDestroyUsAll.gotoAndPlay(1);

    Participant
    October 30, 2017

    Hi Clay,

    Thanks a lot, that worked. Amazing!!! to see the things with gotoAndPlay...

    Is there any documentation or tutorials on how deep we can go! - As i would like to explore

    1. Calling Functions in Animate via JQUERY  - eg playThis() is my function inside animate, how to call it from jquery?

    2. Sending Current Frame Number back to JQUERY so i can have different variations of animations like talking, walking etc...

    It will be extremely helpful as i can go explore the possibilities... Sadly not many leads in the web to find out how this works...

    Thanks,

    Prabu

    Legend
    October 30, 2017

    It's all just JavaScript. Anything you can get a reference to you can control and access.