Comunidad de diseño web y desarrollo en internet online

Tiempo restante

Citar            
MensajeEscrito el 22 Feb 2006 11:37 pm
Qué tal, trato de medir el tiempo restante de mi película flash y utilizo:

Código :

var minutos:Number=0;
var segundos:Number=(_root._totalframes/12);

while(segundos>=60 && ++minutos && (segundos-=60));
_root.duracion=minutos+" m "+substring(String(segundos),1,2)+" s";


Pero cuando lo ejecuto me dice que el script ralentiza la máquina y que debo cerrar el script.
Hay otra forma de medir el tiempo que falta por reproducir en una película?

Por Blue-box

10 de clabLevel



 

firefox
Citar            
MensajeEscrito el 23 Feb 2006 04:06 pm
Bueno ya lo tengo de otra forma preferí cambiar el tipo de contador de min-seg a %. Lo deje así:


Código :

var SegTotales=(_root._totalframes/12);

this.onEnterFrame = function()
{
 SegTrans=(_root._currentframe/12);

 if((100-((SegTrans*100)/SegTotales))<10)
  _root.restante=substring(String((100-((SegTrans*100)/SegTotales))),1,1)+" %";
 else
  _root.restante=substring(String((100-((SegTrans*100)/SegTotales))),1,2)+" %";
}

Por Blue-box

10 de clabLevel



 

firefox
Citar            
MensajeEscrito el 23 Feb 2006 05:07 pm

Código :

this.onEnterFrame = function() {
   var time = (_totalframes-_currentframe)/12;
   var minutes = Math.floor(time/60);
   var seconds = Math.floor(time%60);
   var mili = substring((time%1000), 3, 2);
   trace("Time Left: "+minutes+" : "+seconds+" : "+mili);
};

Saludos!!

Por Cep

BOFH

1509 de clabLevel

9 tutoriales

1 ejemplo

Genero:Masculino   REC Bastard Operators From Hell

Web Developer

firefox

 

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