Skip to main content
Known Participant
June 14, 2014
Answered

Accessing a main timeline function from a object's timeline

  • June 14, 2014
  • 1 reply
  • 460 views

Hi,

I have an object on the stage, MovieClip, with an animation inside.

The animation is called from a class file.

I would like to call for a function, addBubbles, when the animation of the MovieClip has finished.

The function, addBubbles, is described on the main timeline, in the first frame.

But I would like to call for it from inside of that MovieClip, writing the code into the last frame.

How should I reference it, so it would work?

This topic has been closed for replies.
Correct answer Ned Murphy

A couple ways would be to just use...

    MovieClip(root).addBubbles();   OR  MovieClip(parent).addBubbles();

Another way would be to have the MovieClip dispatch a custom event for which you have a listener assigned in the main timeline.  THat listener in the main timeline would have an event handler function that calls the addBubbles function.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
June 14, 2014

A couple ways would be to just use...

    MovieClip(root).addBubbles();   OR  MovieClip(parent).addBubbles();

Another way would be to have the MovieClip dispatch a custom event for which you have a listener assigned in the main timeline.  THat listener in the main timeline would have an event handler function that calls the addBubbles function.

rahexAuthor
Known Participant
June 14, 2014

Thank you, Ned!

Works perfectly

Ned Murphy
Legend
June 14, 2014

You're welcome