Timing delay in flash MX

hi ppl of the forum i have a little Query. iv looked on the past forum posts but the solution i found did’nt work “for me”.

I was wondering how to delay an action with actioniscript i.e. press wait 10seconds then perform action/function i have a crude way but i it calls for animating in the time line and i want to do as little of that as possible

Thanx in advance

Hi,
If you are using MX you can use setInterval(), or if in Flash5, you can user getTimer();
There are posts and tutes on this site for both, if you cannot get it to work properly, post again

SteveD

thank for the quick responce i tried this

Function moveFrames(){
if(_currentframe == 1){
gotoAndStop(2);
} else {
gotoAndStop(1);
}
}
setInterval (moveFrames, 5000);

on the first frame of a movie to test it out but i get this error

Scene=Scene 1, Layer=actions, Frame=1: Line 1: ‘;’ expected
Function moveFrames(){

i can’t see what’s wrong with it may b cus im new to AS

thanx again

Hi,
The reason for the error is your have used a captial F in function, try it in lower case and the error will not exist.
However your code will not work, try setting it up like this:
[AS]
//frame1
stop()
moveFrames = 5000;
delay = setInterval(this, “nextFrame”, moveFrames);

//frame2
moveFrames = 5000;
delay = setInterval(this, “prevframe”, moveFrames);
[/AS]
then once you see how that works you can start to write a function to add to it, or leave it as it is of course

SteveD

thanx im gona have a little play around with it

this forum is wicked. it’s the best flash forum. even better than the macromedia one

Your welcome