setInterval.

  • shendel101
  • Born
  • Born
  • No Avatar
  • Registrado: Ago 23, 2007
  • Mensajes: 2
  • Status: Offline

Nota Agosto 30th, 2007, 1:05 am

cómo llamar a setInterval al bucle de nuevo después de la clearInterval? ejemplo .. si pulsa el botón i i quiere llamar de nuevo el bucle de hacer su función. Gracias ..
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Agosto 30th, 2007, 1:05 am

  • dhonsvick
  • Beginner
  • Beginner
  • No Avatar
  • Registrado: May 27, 2007
  • Mensajes: 49
  • Status: Offline

Nota Agosto 30th, 2007, 9:01 pm

aquí es cómo lo hago

Código: [ Select ]

var myInt;
startInterval();
var who:Array = new Array("He","She","I","ME");

function startInterval(){
  clearInterval(myInt); // clear the interval, to make sure you dont over lap...which has interesting results ;)
  myInt = setInterval(this, "myFunction", 1000);
}

function stopInt(){
  clearInterval(myInt);
}



function myFunction(){
    var randomNum:Number = Math.floor(Math.random() * (3 - 0 + 1)) + 0;
 trace( who[randomNum]+" likes to Move it , Move it");
}
  1. var myInt;
  2. startInterval();
  3. var who:Array = new Array("He","She","I","ME");
  4. function startInterval(){
  5.   clearInterval(myInt); // clear the interval, to make sure you dont over lap...which has interesting results ;)
  6.   myInt = setInterval(this, "myFunction", 1000);
  7. }
  8. function stopInt(){
  9.   clearInterval(myInt);
  10. }
  11. function myFunction(){
  12.     var randomNum:Number = Math.floor(Math.random() * (3 - 0 + 1)) + 0;
  13.  trace( who[randomNum]+" likes to Move it , Move it");
  14. }


Ahora usted puede comenzar con intervalo - startInterval ()

Publicar Información

  • Total de mensajes en este tema: 2 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 44 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC