Dave  
                
               
                 
              
                  
                    October 3, 2004,  3:33am
                   
                   
              1 
               
             
            
              hey guys!  I have already looked for a tut here and other places and i still can’t find what im after.
Im creating a game when they start the game a timer begins , when they finish the game, the timer stops and the time is displayed in minutes and seconds  it took to complete the game.
I don’t this is very hard but i cant get it to work.  I’ve tried the get Timer function but i was unsuccessful.  Can someone please help me?
Thanks guys.
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    October 3, 2004,  8:21am
                   
                   
              2 
               
             
            
              if you have MX (not '04) you should have a look in the samples folder where you installed it. there’s a timer example you might be able to find useful in there
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    October 3, 2004, 12:18pm
                   
                   
              3 
               
             
            
              
ok i’ll give that a go thanks!
Anyone else have any more suggestions???
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    October 3, 2004, 12:19pm
                   
                   
              4 
               
             
            
              Mad your an Aussie too!!!
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    October 3, 2004,  2:22pm
                   
                   
              5 
               
             
            
              there’s also a sample in flashMX using that, in the samples dir.
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    October 4, 2004,  5:02pm
                   
                   
              6 
               
             
            
              I use setInterval for these kind of tasks. Let me look if I’ve got a script for this.
This is a snippet that I used for a game of mine a couple of months ago. You will have to modify it I think. Feel free to use it if its useful.
function startTimer() {
	timerInterval = setInterval(goTimer, 1);
}
function goTimer() {
	startTime += 10;
	
	minutes 		= Math.floor(startTime / 1000 / 60);
	seconds 		= Math.floor((startTime / 1000) % 60);
	milliseconds 	= Math.floor((startTime) % 999);
	
	// display it
	displayTimer();
	
	// if pause pressed
	if (pause == true) {
		oldTime = startTime;
		startTime = 0;
		clearInterval(timerInterval);
	}
}
// display timer
function displayTimer() {
	if (minutes < 10) minuteDisplay = "0" + minutes;
	else minuteDisplay = minutes;
	
	if (seconds < 10) secondsDisplay = "0" + seconds;
	else secondsDisplay = seconds;
	
	if (milliseconds < 10) millisecondsDisplay = "00" + milliseconds;
	else if (milliseconds < 100) millisecondsDisplay = "0" + milliseconds;
	else millisecondsDisplay = milliseconds;
	
	// OUTPUT
	screen_play.block_time.lable = minuteDisplay + ":" + secondsDisplay + ":" + millisecondsDisplay;
}
// pause timer
//function pauseTimer() {
//	pause = true; // pause
	
	// blink timer
	
//}
// continue timer
function continueTimer() {
	pause = false; // no pause anymore
	startTime += oldTime; // old time plus new time
	
	startTimer(); // start timer again
}
// stop timer
function stopTimer() {
	clearInterval(timerInterval);
	totalTime = startTime;
}