Reloj Digital Codigo Fuente
Crear 1 fotogramas claves.
En el fotograma ponemos 7 botones y creamos un clip de pelicula con el nombre reloj.
En el clip de pelicula ponemos 3 textos dinamicos
A los textos dinamicos les ponemos en variables hora, minuto y segundo.
Escribir en acciones en el fotograma:
stop();
//---------------------------------------------
function customcolor(thecolor) {
something=new Color(reloj);
something.setRGB(thecolor);}
//---------------------------------------------
reloj.onEnterFrame = function() {
var fecha = new Date();
this.hora = fecha.getHours();
this.minuto = fecha.getMinutes();
this.segundo = fecha.getSeconds();
if (this.segundo<10) {
this.segundo = "0"+this.segundo;}
if (this.minuto<10) {
this.minuto = "0"+this.minuto; }
if (this.hora<10) {
this.hora = "0"+this.hora; }
};
Ahora en cada boton escribimos en acciones:
Boton 1: Azul
on (release) {
//---------------------------------------------
customcolor(0x0000FF) ;
//---------------------------------------------
}
Boton 2: Verde
on (release) {
//---------------------------------------------
customcolor(0x00FF00) ;
//---------------------------------------------
}
Boton 3: Naranja
on (release) {
//---------------------------------------------
customcolor(0xFF8000) ;
//---------------------------------------------
}
Boton 4: Rojo
on (release) {
//---------------------------------------------
customcolor(0xFF0000) ;
//---------------------------------------------
}
Boton 5: Amarillo
on (release) {
//---------------------------------------------
customcolor(0xFFFF00) ;
//---------------------------------------------
}
Boton 6: Celeste
on (release) {
//---------------------------------------------
customcolor(0x00FFFF) ;
//---------------------------------------------
}
Boton 7: Lila
on (release) {
//---------------------------------------------
customcolor(0xFF00FF) ;
//---------------------------------------------
}
Ir al ejemplo Reloj Digital.swf (8,4 kB)