Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/07/2003, 07:04
Avatar de maralbust@netsc
maralbust@netsc
 
Fecha de Ingreso: julio-2003
Ubicación: Santiago
Mensajes: 242
Antigüedad: 20 años, 9 meses
Puntos: 0
De acuerdo Un Flash Entrete

//*******************************
System.setCodePage = true;
formato = new TextFormat();
formato.font = "standard 07_53";
formato.color = 0xFFFF00;
formato.size = 12;
this.createTextField("miTexto_txt", 8, 50, 230, 350, 100);
miTexto_txt.embedFonts = true;
miTexto.autoSize = true;
this.createTextField("titulo_txt", 9, 80, 20, 350, 100);
titulo_txt.embedFonts = true;
titulo_txt.html = true;
titulo_txt.autoSize = true;
formato2 = new TextFormat();
formato2.font = "standard 07_53";
formato2.color = 0xFFFF00;
formato2.size = 20;
titulo_txt.setTextFormat(formato2);
titulo_txt.textSize = 10;
//*******************************
//arreglos para nombrar los dias y meses al recibir el valor de estos en numero
_global.dia = ["Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado"];
_global.mes = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
//declaramos cual sera el punto de origen para las manecillas
_global.xCentro = 750;
_global.yCentro = 50;
_global.xInicio = 0;
_global.yInicio = 0;
_global.alfa = 100;
_global.ancho = 2;
_global.radio = 30;
//*************************************
MovieClip.prototype.putDepth = function() {
return ++this.depth;
};
//*************************************
MovieClip.prototype.dibujaCirculo = function(x, y, radio, anguloInicial, anguloFinal, segmentos) {
Math.rad = Math.PI/180;
lineStyle(ancho, 0xcccccc, alfa);
var segm = (anguloFinal-anguloInicial)/segmentos;
this.moveTo(x+radio*Math.cos(anguloInicial*Math.ra d), y+radio*Math.sin(anguloInicial*Math.rad));
for (var s = anguloInicial+segm; s<=anguloFinal+1; s += segm) {
var c_x = radio*Math.cos(s*Math.rad);
var c_y = radio*Math.sin(s*Math.rad);
var a_x = c_x+radio*Math.tan(segm/2*Math.rad)*Math.cos((s-90)*Math.rad);
var a_y = c_y+radio*Math.tan(segm/2*Math.rad)*Math.sin((s-90)*Math.rad);
this.curveTo(a_x+x, a_y+y, c_x+x, c_y+y);
}
};
//*************************************
lineStyle(ancho, 0x000000, alfa);
this.createEmptyMovieClip("reloj_mc", 0);
_root.reloj_mc._x += 200;
_root.reloj_mc._y += 200;
with ("reloj_mc") {
this.createEmptyMovieClip("circulo_mc", 4);
with (circulo_mc) {
this.dibujaCirculo(xCentro, yCentro, radio, 0, 360, 8);
}
//creamos clip para manecilla hora
this.createEmptyMovieClip("hora_mc", 2);
with (this.hora_mc) {
lineStyle(ancho, 0xcccccc, alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio+12);
_x = xCentro;
_y = yCentro;
}
//creamos clip para manecilla minutos
this.createEmptyMovieClip("minutos_mc", 1);
with (this.minutos_mc) {
lineStyle(ancho, 0xcccccc, alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio);
_x = xCentro;
_y = yCentro;
}
//funcion para crear manecillas
/* crearManecilla = function (nombreClip, prof, tono, punta) {
this.createEmptyMovieClip(nombreClip,3);
with (this.eval(nombreClip)) {
lineStyle(ancho, eval(tono), alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio);
_x = xCentro;
_y = yCentro;
}
};
crearManecilla("segundos_mc",3,"0x33CCFF",yInicio-radio);
*/
//creamos clip para manecilla minutos
this.createEmptyMovieClip("segundos_mc", 3);
with (this.segundos_mc) {
lineStyle(ancho, 0xcccccc, alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio);
_x = xCentro;
_y = yCentro;
}
cambiaHora = function () {
// creamos nuevo objeto Date
miFecha = new Date();
// estas lineas son solo para desplegar aqui en la ventana de salida los valores
trace(miFecha.getFullYear());
trace(mes[miFecha.getMonth()]);
trace(miFecha.getDate());
trace(dia[miFecha.getDay()]);
trace(miFecha.getHours());
trace(miFecha.getMinutes());
trace(miFecha.getSeconds());
// *******************************
// funcion con la que agregamos el CERO
function agregaCero(valor) {
// si el valor del numero es menor que 10...
if (valor<10) {
// concatenamos un 0 antes del valor original
valor = "0"+valor;
}
// regresamos valor
return valor;
}

// giramos cada una de las manecillas :D
// ***************************
// hora (las horas giran mas lento que los mins y segs. :P )
hora_mc._rotation = miFecha.getHours()*30;
// minutos
minutos_mc._rotation = miFecha.getMinutes()*6;
// segundos
segundos_mc._rotation = miFecha.getSeconds()*6;
};
cambiaHora();
setInterval(cambiaHora, 1000);
}