Hey all,
A couple weeks ago, I was searching for a delay function that I could put on a frame and it would hold at that frame for a given period of time.
I came close to finding it, but what I found used setInterval and I wasn’t able to stop it from looping.
Here is something that I am quickly starting to love, it’s not mine, but I don’t know who’s it is, it was on a piece I was working on at work (although this edition of it is partly mine, as I have adapted it to my specific needs).
hope this helps someone!
first frame
//wait function
function wait(a) {
stop();
startTime = getTimer();
this.onEnterFrame = function() {
if (getTimer()-startTime>a) {
delete this.onEnterFrame;
play();
}
};
}
//pause between frames
var delay = 2000;
then on the frame you want to pause or delay:
wait(delay);