# Event listener to check that function complete

**URL:** <https://forum.kirupa.com/t/event-listener-to-check-that-function-complete/305802>\
**Category:** flash\
**Created:** [March 3, 2010, 6:46pm UTC](https://forum.kirupa.com/t/event-listener-to-check-that-function-complete/305802 "2010-03-03T18:46:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewF](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andrewF](https://forum.kirupa.com/u/andrewF)\
**Post date:** [March 3, 2010, 6:46pm UTC](https://forum.kirupa.com/t/event-listener-to-check-that-function-complete/305802/1 "2010-03-03T18:46:21Z")

</div>

I am trying to create an event listener to check that a function has completed before the next action is run. In simple terms I have a module that is opened and closed via two functions… module\_open() and module\_close().

Each function has tween elements that must complete before the next element is processed… i.e the next function, etc.

This is the code I have ( have attempted to create an event listener but I seem doing something wrong. I am not even sure that it is possible to create an event listener that checks for a function finishing before calling the next function.

```auto

function onAbout(event:Event):void {

    module_close()
    module_close.addEventListener(Event.COMPLETE, onClose_Complete);
    
    function onClose_Complete():void{
    
    logo_block.gotoAndPlay("about");
    title_text.gotoAndStop("about");

    if (empty_mc_main.numChildren >0) {
        empty_mc_main.removeChildAt(0);
    }
    
    var myMovieClip:MovieClip = new about_page_mc();
    empty_mc_main.addChild(myMovieClip);
    
    living_btn.visible = false;
    lifestyle_btn.visible = false;
    elements_btn.visible = false;
    colour_btn.visible = false;
    
    }

}

```

I expect there is a standard way of doing this.

Any help much appreciated.

Thx
