Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/01/2008, 08:42
grid
 
Fecha de Ingreso: julio-2003
Ubicación: Viña del mar
Mensajes: 111
Antigüedad: 20 años, 9 meses
Puntos: 0
cronometro...

Hola tengo un flash con un cronometro, necesito saber cómo puedo ejecutar una función cuando el cronometro marque un tienpo determinado, un minutos, o dos o lo que sea

Código:
//Inicializamos cronometro
_root.timer_txt.text = "00:00:00:00";
play_reloj = function()
{
	if(!_root.timing) 
	{
		if (_root.paused) 
		{
			//Restamos el tiempo transcurrido durante la pausa
			_root.startTime = getTimer() - _root.elapsedTime;
		} 
		else 
		{
			//Empezamos la cuenta
			_root.startTime = getTimer();
		}
		//Variables boolaneas
		_root.paused = false;
		_root.timing = true;
	}
}


pause_reloj = function() 
{
	//Solamente para si se esta reproduciento (timing = true)
	if(_root.timing) 
	{
		_root.timing = false;
		_root.paused = true;
	}
}

stop_reloj = function() 
{
	//Para el tiempo
	_root.timing = false;
	//Resetea la variable pausa
	_root.paused = false;
	//Resetea el dispaly (timer_txt)
	_root.timer_txt.text = "00:00:00:00";
}

_root.onEnterFrame = function() 
{
	if (timing) 
	{
		//Calcula valores
		elapsedTime = getTimer()-startTime;
		//horas
		elapsedHours = Math.floor(elapsedTime/3600000);
		remaining = elapsedTime-(elapsedHours*3600000);
		//minutos
		elapsedM = Math.floor(remaining/60000);
		remaining = remaining-(elapsedM*60000);
		//segundos
		elapsedS = Math.floor(remaining/1000);
		remaining = remaining-(elapsedS*1000);
		//Milesimas
		elapsedH = Math.floor(remaining/10);
		//Salida del display
		//Añade 0 a los numeros si el numero es menor que 10
		if (elapsedHours < 10) 
		{
			hours = "0"+elapsedHours.toString();
		} 
		else 
		{
			hours = elapsedHours.toString();
		}
		if (elapsedM < 10) 
		{
			minutes = "0"+elapsedM.toString();
		} 
		else
		{
			minutes = elapsedM.toString();
		}
		if (elapsedS < 10) 
		{
			seconds = "0"+elapsedS.toString();
		} 
		else
		{
			seconds = elapsedS.toString();
		}
		if (elapsedH < 10) 
		{
			hundredths = "0"+elapsedH.toString();
		} 
		else 
		{
			hundredths = elapsedH.toString();
		}
		//salida
		_root.timer_txt.text = hours+":"+minutes+":"+seconds+":"+hundredths;
	}
};

stop_reloj();
play_reloj();