Hola lista,
Bueno os explico de que va la cosa:
La idea es crear dos funciones para controlar las lineas de tiempo de los
MC, cosa que est� solucionada con:  MC.gotoandStop(MC._currentfotogram+1) y
MC.gotoandStop(MC._currentfotogram-1) cada una de ellas en un onEnterFrame y
listo.
Pero esto nos mueve la linea de tiempo de forma lineal sin control sobre la
aceleraci�n. Valiendome de una de las ecuaciones de Robert Penner he puesto
lo siguiente:

Math.easeInOutCubic = function(t, b, c, d) {  //esta es la ecuaci�n
 t /= d/2;
 if (t<1) {
  return c/2*t*t*t+b;
 }
 t -= 2;
 return c/2*(t*t*t+2)+b;
};

function adelante() {
 b = 1;
 c = this._totalframes;
 d = 30;
 t = 0;
 this.createEmptyMovieClip("control", 1000);
 this.control.onEnterFrame = function() {
  if (t<d) {
   aceleracion = Math.ceil(Math.easeInOutCubic(t, b, c, d));
   t++;
   this._parent.gotoAndStop(aceleracion);
   trace(this._parent._currentframe);
  } else {
   this.removeMovieClip();
   trace("si");
  }
 };
}


function atras() {
 b = this._totalframes;
 c = 1;
 d = 30;
 t = 0;
 this.createEmptyMovieClip("control", 1000);
 trace(control)  // ==========================>>>>// ESTE ES EL PROBLEMA QUE
LA INSTANCIA APARECE COMO "UNDEFINED" en el momento
//que ejecutamos esta funci�n despues de la primera.

// � ALGUNA IDEA COMO PLANTERA ESTO MEJOR ?
 this.control.onEnterFrame = function() {
  if (t<d) {
   aceleracion = Math.ceil(Math.easeInOutCubic(t, b, c, d));
   t++;
   this._parent.gotoAndStop(aceleracion);
   trace(this._parent._currentframe);
  } else {
   this.removeMovieClip();
   trace("si");
  }
 };
}
ba.onRelease = function() {
 adelante.apply(c);
};
bb.onRelease = function() {
 atras.apply(c);
};
//APARTE DE PODER SOLUCIONAR LA CREACI�N DEL MC "CONTROL" � HAY ALGUNA
MANERA MAS PRACTICA DE PLANTEAR ESTAS FUNCIONES?
Lo que quiero decir que quizas si fueran m�todos del propio MC  o una clase
aparte funcione mejor.
Es aqui donde me encuentro y os pido ayuda.
Muchas gracias
Rafael
www.fabricanet.com



<!-------------------------------
Lista ASNativos:
subscripciones/desubscripciones
http://www.sidedev.net/asnativos
-------------------------------->

Responder a