# Event That Listens for Function Completion

**URL:** <https://forum.kirupa.com/t/event-that-listens-for-function-completion/233561>\
**Category:** flash\
**Created:** [July 25, 2007, 12:25am UTC](https://forum.kirupa.com/t/event-that-listens-for-function-completion/233561 "2007-07-25T00:25:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icekube12jr](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@icekube12jr](https://forum.kirupa.com/u/icekube12jr)\
**Post date:** [July 25, 2007, 12:25am UTC](https://forum.kirupa.com/t/event-that-listens-for-function-completion/233561/1 "2007-07-25T00:25:35Z")

</div>

Hi,

This is what is currently happening with my code:

I make a call to a function on the first frame of my main timeline. Within that function there are some event listeners that listen for a certain object to be ADDED\_TO\_STAGE. After that call to the function on the first frame of my main timeline, I make another call to another function. But I only want the second function to start once the certain object I mentioned from the first function has been ADDED\_TO\_STAGE. And no, I can’t just put the second function call within the ADDED\_TO\_STAGE listener for reasons that would take too long to explain. So, basically, I need a way to stall the code on the main timeline from executing the second function call while the first function has not completely finished (including the call of the listener). I hope I explained this ok.

O and also, I don’t want to just throw down a timer or something. I need it to be efficient. Let me know if there is a way that I can create an event that listens for function completion. Thanks

icekube12jr
