Ver Mensaje Individual
  #6 (permalink)  
Antiguo 04/08/2004, 12:54
Avatar de TMeister
TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
Si es sencillo, lo unico te tienes que hacer es una resta.....

Analiza esto copia/pega y disfruta....

Código:
function makeBoton(tmp_mc, ancho, largo, prof, col, label) {
	var tm_mc = tmp_mc.createEmptyMovieClip("tempo"+prof, prof);
	tm_mc.lineStyle(1, col);
	tm_mc.beginFill(col);
	tm_mc.lineTo(0, 0);
	tm_mc.lineTo(0+largo, 0);
	tm_mc.lineTo(0+largo, 0+ancho);
	tm_mc.lineTo(0, 0+ancho);
	tm_mc.lineTo(0, 0);
	tm_mc.createTextField("label_txt", 1, 0, 0, 0, 0);
	tm_mc.label_txt.autoSize = true;
	tm_mc.label_txt.text = label;
	return tm_mc;
}
//Creamos el Campo de Salida
createTextField("label_txt", 10, 200, 180, 0, 0);
label_txt.autoSize = true;
label_txt.text = "Segundos 0.0";
//Creamos el Boton que iniciara la cuenta
clip_mc = makeBoton(this, 20, 55, 1, 0xcccccc, "Comenzar");
clip_mc._x = 200;
clip_mc._y = 200;
//Creamos el Boton que detendra la cuenta
clip1_mc = makeBoton(this, 20, 55, 2, 0xcccccc, "Parar");
clip1_mc._x = 260;
clip1_mc._y = 200;
/*************************************************************
                    Aqui esta lo interesante
*************************************************************/
function iniciaCron() {
	timeIni = getTimer();
	clip_mc.onEnterFrame = function() {
		transcurrido = (getTimer()-timeIni)/1000;
		//Redondeamos y formateamos los segundos 
		//con un decimales a 0.00
		transcurrido = (Math.round(transcurrido*10)/10);
		label_txt.text = "Segundos "+transcurrido;
	};
}
function parar() {
	delete clip_mc.onEnterFrame;
}
clip_mc.onRelease = iniciaCron;
clip1_mc.onRelease = parar;
Si quedan dudas por aqui andamos...

Saludos!!