Comunidad de diseño web y desarrollo en internet online

Control de un Cronometro

Citar            
MensajeEscrito el 29 Ago 2005 07:12 pm
:? Por favor necesito si alguien tiene alguna idea de porque no me funciona los comandos .getDate .getSeconds .getMinutes;

Estoy realizando un cronometro, para una aplicación, intenté hacerla son una función y que este se actualizará con cada frame que entra, pero se desfasa ahora intento hacerla con la hora del sistema pero me encontré un ejemplo aquí utilizando los comandos para fecha y hora pero no funcionan, no me muestra nada... :|

Diganme que puedo hacer y se los agradeceré mucho

Por Agomez

2 de clabLevel



Genero:Masculino  

México

msie
Citar            
MensajeEscrito el 29 Ago 2005 07:38 pm
Que codigo estas usando? :?
Prueba esto en el frame principal:

Código :

fecha = new Date();
trace(fecha.getDate()+"/"+(fecha.getMonth()+1)+"/"+fecha.getFullYear());


Primero tienes que crear un Objeto Date. Y luego usar los distintos metodos, eje: getDate(), getDay(), etc.

Saludos

Por dave73

985 de clabLevel

5 tutoriales

 

Argentina, Córdoba

firefox
Citar            
MensajeEscrito el 29 Ago 2005 07:53 pm
Primero create un texto dinamico llamado "fecha", luego en el frame donde tienes insertado el texto dinamico insertas este codigo:


Código :

onEnterFrame = function() {
  objDate = new Date();
  var dia=objDate.getDate();
  var mes=objDate.getMonth()+1;
  var año=objDate.getFullYear();
  fecha.text="Hoy es "+dia+"/"+mes+"/"+año;}


y para un reloj pues pon este:



y debe funcionarte, pk es un CopyPaste de uno que hize.

Código :

onEnterFrame = function() {
  objDate = new Date();
  var dia=objDate.getDate();
  var mes=objDate.getMonth()+1;
  var año=objDate.getFullYear();
  fecha.text="Hoy es "+dia+"/"+mes+"/"+año;
  hora_text.text = objDate.getHours();
  if(objDate.getHours()>12)
  {
   hora_text.text = objDate.getHours()-12;
   if(objDate.getHours()==0)
   {hora_text.text = objDate.getHours()+12;}
   ampm.text="pm";}
   else
   {ampm.text="am";}
  if(objDate.getHours()<10)
  {hora_text.text="0"+hora_text.text}
  
  
minutos_text.text = objDate.getMinutes();
if(objDate.getMinutes()<10)
{minutos_text.text="0"+minutos_text.text;}
segundos_text.text = objDate.getSeconds();
if(objDate.getSeconds()<10)
{segundos_text.text="0"+segundos_text.text;}
  

};


Recuerda crear los textos dinamicos que se necesitan.

Por Jorgelig

Claber

3035 de clabLevel

12 tutoriales

 

Monterrey, Nuevo Leon, MX

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.