Advertisement
Guest User

Timer

a guest
Mar 28th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. minutos = 10;
  2. segundos = minutos*60;
  3.  
  4. contagem = function(){
  5.     segundos--;
  6.     mostrarTempo();
  7.     if(_root.segundos<=0){
  8.         trace("FIM");
  9.         clearInterval(intervalo);
  10.     }
  11. }
  12. intervalo = setInterval(contagem,1000);
  13.  
  14. function mostrarTempo(){
  15.     minutos = Math.floor(segundos/60);
  16.     min = minutos%60;
  17.     seg = segundos%60;
  18.     if (seg<10) {
  19.         seg = "0"+seg;
  20.     }
  21.     if (min<10) {
  22.         min = "0"+min;
  23.     }
  24.     trace(min+":"+seg);
  25. }
  26. mostrarTempo();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement