Comunidad de diseño web y desarrollo en internet online

ayuda con contador de tiempo en as3

Citar            
MensajeEscrito el 20 Dic 2010 05:16 pm
quiero crear un contador en as3 de 20 segundos en cada fotograma y avance al siguiente curiosamente al publicarlo desde cs5 funciona pero si lo ejecuto en el navegador se bloquea. podriais ayudarme pongo el codigo:


var speed:Number = 1000;

var timer:Timer = new Timer(speed, 20);
timer.addEventListener(TimerEvent.TIMER, countdown);
timer.start();
function countdown(event:TimerEvent) {
var totalSecondsLeft:Number = 20 - timer.currentCount;
myText.text = timeFormat(totalSecondsLeft);
}

function timeFormat(seconds:int):String {
var sSeconds:String;
if (seconds == 0) {
resettimer();
}
if (seconds > 21) {
sSeconds = String(seconds % 60);
} else {
sSeconds = String(seconds);
}
if (sSeconds.length == 1) {
sSeconds = "0" + sSeconds;
}
return ":" + sSeconds;

}

function resettimer() {
nextFrame();
}

function moveOn() {

}

Por CLAnonimo

Claber

600 de clabLevel

5 tutoriales
1 articulo

 

Este es un usuario anónimo genérico para las cuentas borradas o perdidas.

chrome
Citar            
MensajeEscrito el 20 Dic 2010 06:29 pm
Tengo varias preguntas.

Ese es todo el codigo??,Que es lo que se bloquea??, Donde se manda llamar resettimer??


Saludos.

Por Angel Roberto

Claber

248 de clabLevel



 

firefox

 

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