For Flash MX.
How do I go about setting time delays on Movieclips using actionscript? Could somebody point me in the right direction as to what terms to look for or a sample piece of code to look at?
Thanks.
Printable View
For Flash MX.
How do I go about setting time delays on Movieclips using actionscript? Could somebody point me in the right direction as to what terms to look for or a sample piece of code to look at?
Thanks.
Hello,
Stop movie for number of seconds
Note that frame 2 was just for debugging but you can't go back to frame 1 at any stage because it will reset the start time and your timer will never run down....Code:Frame 1:
mydate = new Date();
startSec = mydate.getSeconds();
Frame 2:
waited = startSec - nowSec;
Frame 3:
mydate2 = new Date();
nowSec = mydate2.getSeconds();
if (nowSec == startSec + 10 || nowSec == (60 - startSec)) {
trace ("10 seconds up");
stop ();
} else {
gotoAndPlay (2);
}
Or
Drop the following code into the frame you want to pause:
This will pause the movie for 3 seconds.Code:start = getTimer();
while (start+3000>now) {
now = getTimer();
}
Hope it helps
Regards
~GD~
I'll have a snoop at this and give it a try. Thanks for taking the time to answer.
Hello,
I used the bottom script you sent but it only plays the time delay on one movie clip. I have a time delay on three seperate clips in the same movie all with different times set. Any ideas how to get around this?
Thanks