All pastes #2046439 Raw Edit

Something

public text v1 · immutable
#2046439 ·published 2011-04-14 15:57 UTC
rendered paste body
var diaFinal:Date = new Date(2011,04,-14.8,-7.8,-46.8);
var cronometroCuentaRegresiva:Timer = new Timer(1000);
cronometroCuentaRegresiva.addEventListener(TimerEvent.TIMER, actualizarHora);
cronometroCuentaRegresiva.start();
function actualizarHora(e:TimerEvent):void
{
	var hoy:Date = new Date();
	var tiempoRestante:Number = diaFinal.getTime() - hoy.getTime();
	var segundos:Number = Math.floor(tiempoRestante / 1000);
	var minutos:Number = Math.floor(segundos / 60);
	var horas:Number = Math.floor(minutos / 60);
	var dias:Number = Math.floor(horas / 24);
	
	segundos %= 60;
	minutos %= 60;
	horas %= 24;

	var sec:String = segundos.toString();
	var min:String = minutos.toString();
	var hrs:String = horas.toString();
	var d:String =  dias.toString();
	
	if (sec.length < 2) {
		sec = "0" + sec;
	}
	
	if (min.length < 2) {
		min = "0" + min;
	}
	
	if (hrs.length < 2) {
		hrs = "0" + hrs;
	}

	if (dias == '1') { stop; }
	
	
	var tiempo:String = d + ":" + hrs + ":" + min + ":" + sec;
	tiempo_txt.text = tiempo;
	}

	function abrir (e:Event):void { navigateToURL (new URLRequest ("http://www.vipsociety.com/dimaio")); }
	boton.addEventListener (MouseEvent.CLICK, abrir);