# Global function to stop/start timelines

**URL:** <https://forum.kirupa.com/t/global-function-to-stop-start-timelines/289622>\
**Category:** flash\
**Created:** [June 2, 2009, 4:07pm UTC](https://forum.kirupa.com/t/global-function-to-stop-start-timelines/289622 "2009-06-02T16:07:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdawg](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@kdawg](https://forum.kirupa.com/u/kdawg)\
**Post date:** [June 2, 2009, 4:07pm UTC](https://forum.kirupa.com/t/global-function-to-stop-start-timelines/289622/1 "2009-06-02T16:07:49Z")

</div>

I was wondering if someone could shed some light in helping translate a AS2 function to AS3. It stops the movie’s timeline from where you called the function. Thanks much.  
[LEFT]

```auto

MovieClip.prototype.wait = function(n:Number) {
    this.stop();
    this.myInterval = setInterval(mx.utils.Delegate.create(this, function () {
        this.play();
        clearInterval(this.myInterval);
    }), n*1000);
};

```

[/LEFT]
