Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/10/2007, 09:10
Avatar de SinguerInc
SinguerInc
 
Fecha de Ingreso: octubre-2007
Ubicación: Barcelona, España
Mensajes: 551
Antigüedad: 16 años, 6 meses
Puntos: 5
Re: Reloj contador....

Algo asi?, esto solo funciona con un tiempo menor a 1 dia, obviamente se puede hacer mas complicado
Código:
var now:Date = new Date();
var stopDate:Date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes()+5);
var interval:Number = setInterval(calculateTime, 1000);
function calculateTime()
{
	now = new Date();
	var rest:Date = new Date(stopDate.getTime() - now.getTime());
	trace(rest.getHours() + ":" + rest.getMinutes() + ":" + rest.getSeconds());
	if(now.getTime() >= stopDate.getTime()) clearInterval(interval);
}