I use flash quiz game template from MX (converted to CS4. works well).
AS2. 12fps. 20 questions published in random order.
I tried to insert a timer in it. I tested, in the 3rd question I waited till the time is up and it goes to a certain frame I've set ("timeout" frame I made at the very end of timeline). So it worked.
But, if I continue to play (still in given time), in the middle of the game, say in the 8th question, it suddenly jumped to the score page (with no score).
What did I do wrong?
This is the script I embed to the timer mc:
onClipEvent(load){
sec = 0 ;
min = 3 ;
start = 0 ;
}
onClipEvent(enterFrame){
if(start == 0){
if(_currentframe == 12){
sec -= 1 ;
if(sec < 0){
sec = 59 ;
min -= 1
}
}
}
if(sec < 10){
clock_sec = "0" + sec ;
}else {
clock_sec = sec ;
}
if(sec==60){
clock_sec="00"
}
if(min < 10){
clock_min = "0" + min ;
}else {
clock_min = min ;
}
if(min == 0 and sec ==0 ){
start = 1 ;
_root.gotoAndStop ("timeout") ;
}
}
- onClipEvent(load){
- sec = 0 ;
- min = 3 ;
- start = 0 ;
- }
- onClipEvent(enterFrame){
- if(start == 0){
- if(_currentframe == 12){
- sec -= 1 ;
-
- if(sec < 0){
- sec = 59 ;
- min -= 1
- }
- }
- }
- if(sec < 10){
- clock_sec = "0" + sec ;
- }else {
- clock_sec = sec ;
- }
-
- if(sec==60){
- clock_sec="00"
- }
-
- if(min < 10){
- clock_min = "0" + min ;
- }else {
- clock_min = min ;
- }
-
- if(min == 0 and sec ==0 ){
- start = 1 ;
- _root.gotoAndStop ("timeout") ;
- }
- }
Should I add any scripts in root frame or something?
PS: can I apply hi-score to this kind of template without ruin it?
Thanks in advance.