# Simple Script to Generate a Delay in Timeline

**URL:** <https://casparcgforum.org/t/simple-script-to-generate-a-delay-in-timeline/2174>\
**Category:** FAQ\
**Created:** [August 23, 2019, 3:45am UTC](https://casparcgforum.org/t/simple-script-to-generate-a-delay-in-timeline/2174 "2019-08-23T03:45:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Falkiner](https://casparcgforum.org/letter_avatar_proxy/v4/letter/f/858c86/32.png) [@Falkiner](https://casparcgforum.org/u/Falkiner)\
**Post date:** [August 23, 2019, 3:45am UTC](https://casparcgforum.org/t/simple-script-to-generate-a-delay-in-timeline/2174/1 "2019-08-23T03:45:20Z")

</div>

Hey everyone,

I was working with a template that needs to rotate, so I was wondering if AS3 had some function like sleep.

Then while Googling I found this simple script, so I’m sharing here, maybe it will help someone else! 🙂

```auto
import flash.utils.Timer;
import flash.events.TimerEvent;
 stop();
    var myTimer:Timer = new Timer(30000, 1);
    myTimer.start();
    myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:TimerEvent){
        play();
    });

```

Just add this script as a Action of a frame and change the value “30000” to how much you want stop in ms (30000 = 30 secs).

If you need to add it to another frame of the timeline remember to remove the “imports” and the second line (the one that starts with “var”).

See ya! 😃
