


Crear un nuevo archivo en AS3, con la herramienta texto (T) escribimos 00:00:00:00 que sera nuestro reloj. Luego lo seleccionamos y lo cambiamos en Propiedades a "Dynamic Text" (o "Texto Dinamico" en version español). Listo el pollo, ahora solo tenemos que crear un nuevo layer y en el frame 1 colocamos el siguiente Script AS3. Ojala les haya sido de utilidad.

Código ActionScript :
var diaFinal:Date = new Date(2011,09,2); 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; } var tiempo:String = d + ":" + hrs + ":" + min + ":" + sec; tiempo_txt.text = tiempo; if (tiempo_txt.text < "00:00:00:00"){ tiempo_txt.text = "Countdown is done.";} }
Si les da error es porque le deben agregar una llave de cierre al final de todo } , por algun motivo que desconozco no se muestra en el script de arriba.
Y si lo que quieren es que cuando el reloj llegue a cero ir a un fotograma pues le borran esta linea (la ultima)
Código ActionScript :
tiempo_txt.text = "Countdown is done.";
y la cambian por esta
Código ActionScript :
gotoAndStop(2)