Help: Timer on Flash Game doesn't work

  • mico
  • Beginner
  • Beginner
  • User avatar
  • Posts: 54
  • Loc: Neo Universe

Post 3+ Months Ago

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:

Code: [ Select ]
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") ;
    }
}
  1. onClipEvent(load){
  2.     sec = 0 ;
  3.     min = 3 ;
  4.     start = 0 ;
  5. }
  6. onClipEvent(enterFrame){
  7.     if(start == 0){
  8.         if(_currentframe == 12){
  9.             sec -= 1 ;
  10.             
  11.             if(sec < 0){
  12.                 sec = 59 ;
  13.                 min -= 1
  14.             }
  15.         }
  16.     }
  17.     if(sec < 10){
  18.         clock_sec = "0" + sec ;
  19.     }else {
  20.         clock_sec = sec ;
  21.     }
  22.     
  23.     if(sec==60){
  24.         clock_sec="00"
  25.     }
  26.     
  27.     if(min < 10){
  28.         clock_min = "0" + min ;
  29.     }else {
  30.         clock_min = min ;
  31.     }
  32.     
  33.     if(min == 0 and sec ==0 ){
  34.         start = 1 ;
  35.         _root.gotoAndStop ("timeout") ;
  36.     }
  37. }


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.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 18 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.