# When function complete do next

**URL:** <https://forum.kirupa.com/t/when-function-complete-do-next/320261>\
**Category:** Uncategorized\
**Created:** [March 18, 2011, 10:07am UTC](https://forum.kirupa.com/t/when-function-complete-do-next/320261 "2011-03-18T10:07:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohm](https://avatars.discourse-cdn.com/v4/letter/r/4af34b/32.png) [@rohm](https://forum.kirupa.com/u/rohm)\
**Post date:** [March 18, 2011, 10:07am UTC](https://forum.kirupa.com/t/when-function-complete-do-next/320261/1 "2011-03-18T10:07:27Z")

</div>

Being a bit new to AS3 I just cant figure this one out on my own even though I’ve look at some discutions at different forums but I dont quite get it

My problem is that getTourData(); kicks in too early and I dont want to use a timer 'cus I dont know how long removeAllMyChildren is going to take since it may be large sometimes. Give me a hint please, which way to go

AS3

```auto

    // years down
        this.arrowbtnMC.yearsBtnsMC.topArrDwnMC.addEventListener ('click', function() {;
    if (startYear==yearArr) { 
        yearArr--;
        removeAllMyChildren(); 
// when done removeAllMyChildren; do getTourData
        getTourData(yearArr);
    };
    });

function removeAllMyChildren(){
            while (textMoverMC.numChildren) {
            textMoverMC.removeChildAt(0);
        }
        while (compNameMoverMC.numChildren) {
            compNameMoverMC.removeChildAt(0);
        }
}

```
