Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/12/2005, 09:21
Avatar de Xphoenix
Xphoenix
 
Fecha de Ingreso: abril-2004
Mensajes: 96
Antigüedad: 20 años
Puntos: 0
Cual es el fallo

Cual es el problema en este codigo al hacer un test de la pelicula todo bien, pero al publicar el swf el día y el mes me aparecen undefined.




format = new TextFormat();
format.font = "Arial";
format.color = "0xFFFFFF";
format.bold = true;


this.createTextField("hora_txt", 1, 150, 20, '', '');
this.hora_txt.autoSize = true;

this.createTextField("fecha_txt", 2, 150, 35, '', '');
this.fecha_txt.autoSize = true;

this.onLoad = function() {

dias = new Array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado");

meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
};


this.onEnterFrame = function() {

tiempo = new Date();
dia = tiempo.getDay();
mes = tiempo.getMonth();
hoy = tiempo.getDate();
año = tiempo.getFullYear();
hora = tiempo.getHours();
minuto = tiempo.getMinutes();
segundo = tiempo.getSeconds();

if(hora>=12 && hora<=23){
meridiano = "P.M.";
} else {
meridiano = "A.M.";
}
if (hora == 0) {
hora = "12";
}

if (hora>12) {
hora -= 12;
}

if (hora<=9) {
hora = "0"+hora;
}
if (minuto<=9) {
minuto = "0"+minuto;
}
if (segundo<=9) {
segundo = "0"+segundo;
}

this.hora_txt.text = hora+":"+minuto+":"+segundo+" "+meridiano;
this.fecha_txt.text = dias[dia]+", "+hoy+" de "+meses[mes]+" de "+año;
// aplicamos el formato de texto anteriormente creado
this.hora_txt.setTextFormat(format);
this.fecha_txt.setTextFormat(format);
};