View Full Version : Timer
matteh
02-11-2006, 08:50 AM
Hi peeps!
I need a actionscript script so i can time 60 seconds then it goes to a different frame. Please give me some help. If its not AS please can you tell me how to do it.
Thanks
onClipEvent (load)
{
delayInMilliseconds = 6000;
timeStamp = getTimer() + delayInMilliseconds;
}
onClipEvent (enterFrame)
{
if (getTimer() > timeStamp)
{
_root.gotoAndPlay(23);
}
}
getTimer() returns the time in milliseconds since the SWF-started playing
You will need to put this code in a movieclip, or replace onClipEvent(enterFrame) with an intervall. (press F1, search for it)
matteh
02-11-2006, 11:00 AM
Ok.... ive put that on a movieclip, but how do i make it go to a different frame after the 60 seconds?
EDIT: Also, if i just put itg in, it comes up with this error
----------------------------------------------------------------
timeStamp) //is current time larger than the stamp? { gotoAndStop(differentFrame); }}
Total ActionScript Errors: 1 Reported Errors: 1
----------------------------------------------------------------
Ok.... ive put that on a movieclip, but how do i make it go to a different frame after the 60 seconds?
Sorry, I didn't think that far ahead. ^^
The code I gave you would jump the movieclip's timeline to differentFrame. If that's what you want to to, you will have to name a frame (look in the properties pane) and replace differentFrame with that name. You can also just send the frame number;
gotoAndPlay(60); //jumps this MC to frame 60
If you want to move along the main timeline, I think you can do this;
_root.gotoAndPlay(60); //jumps to frame 60 on main timeline?
EDIT: Also, if i just put itg in, it comes up with this error
----------------------------------------------------------------
timeStamp) //is current time larger than the stamp? { gotoAndStop(differentFrame); }}
Total ActionScript Errors: 1 Reported Errors: 1
----------------------------------------------------------------
You can't have code on the same line as the comment.
Also, you have to define differentFrame before using it;
differentFrame = 60;
or perhaps
differentFrame = "framename"
matteh
02-11-2006, 11:16 AM
Im pretty new to flash so im not sure if thats what i want. All i want is a timer that lasts 60 seconds then goes to frame 23. It would be usefull if you could give me something that I could just put straight in.
Thanks
EDIT: Ive done everything youve said for the original code, but it doesnt go after 60 seconds
Im pretty new to flash so im not sure if thats what i want. All i want is a timer that lasts 60 seconds then goes to frame 23. It would be usefull if you could give me something that I could just put straight in.
Thanks
EDIT: Ive done everything youve said for the original code, but it doesnt go after 60 seconds
Check my first code again.
matteh
02-11-2006, 11:26 AM
Please see my last post again
matteh
02-11-2006, 11:34 AM
Ive put it in a movieclip... i dont know the other one
Look. Just download this demo and do what I did.
matteh
02-11-2006, 11:42 AM
Ahhh... thanks sooo much, it works now :)
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.