Actionscript 2.0 Wait Function with setInterval
Categorized under: Flash-Tips

// the code below belongs on keyframe 1 on the root of the movie
//waiting
MovieClip.prototype.wait = function(interval) {
this.stop();
this.interval = interval*1000;
this.startTime = getTimer();
this.onEnterFrame = function() {
if ((getTimer()-this.startTime)>this.interval) {
delete this.onEnterFrame;
this.play();
}
};
};
wait(4); //using this will pause they playing for 4 seconds then play
— Zeus ::)
Jul 08, 2009

