Simple Script to Generate a Delay in Timeline

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! :slight_smile:

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! :smiley: