countdown timers - flash 8

Started by: roker | Replies: 5 | Views: 569

roker

Posts: 0
Joined: May 2026
Jun 1, 2008 3:35 PM #145994
hey guys i got an assingment and basically i need to make a multiple question quiz but it needs a countdown timer... and once the timer has counted down to zero from 20 (in seconds) it needs to minus 1 from the score (scr)
got no idea code wud be great and it needs to have a bar (like a preloader) that counts down... alls i really need is code and where to put it. nothing i have googled has seemed to help so u guyses are my last chance

-roker
Komaru
2

Posts: 263
Joined: Jan 2008
Rep: 10

View Profile
Jun 1, 2008 3:55 PM #146011
On the timeline, have you Q on frame one. on the frame where 20 seconds is (20 times your framerate) put this
_root.yourscore -= 1;
(yourscore being the scoring variable)
roker

Posts: 0
Joined: May 2026
Jun 1, 2008 4:11 PM #146027
gold... ty... was missing the "root" part...
one question tho... once the variable hits 0 how can i send it to another frame...
im not so great at actionscript.
after something like
on frame 1 put the question with the buttons and a
movie clip that has a clock and something displaying the variable under it
and for the frame set the variable to 20. then on frame 2 put an if command saying if it variable 1 = 0 then goto whatever frame i have the (time run out) message in and an else statment saying gotoand play frame 3. then in 21 frames have a {gotoAndPlay (2)}
roker

Posts: 0
Joined: May 2026
Jun 1, 2008 4:20 PM #146041
ohhh wait... i see...
by adding _root. to the beg of a variable it will let me alter a "global" variable inside a movie clip...
ok srry disregard last post
ty
Lixu

Posts: 3,859
Joined: Aug 2007
Rep: 10

View Profile
Jun 1, 2008 5:21 PM #146085
there is a code something like this_.gotoAndplay(a number) something like that, so you could add it on the frame where 0 is, and then it will play to the other frame automaticly
Rather Cheesy
2

Posts: 2,137
Joined: Apr 2007
Rep: 10

View Profile
Jun 1, 2008 11:58 PM #146424
I'd make a movieclip with a bar shrinking down that lasts 20 seconds long, at the end of it I'd put this code

_root.score -=1

then on your main stage put this on the frame

score = 0

now make a dynamic text box [drop down menu when you have the text tool selected] and give it a variable name of score

Now you can add it in with whatever you already have for your quiz and you have the bar and all.