Comunidad de diseño web y desarrollo en internet online

onMotionfinished() de la clase Tween

Citar            
MensajeEscrito el 11 Abr 2008 10:04 am
Buenas,

El problema es q estoy haciendo una animación de salida con la clase Tween en la que enlazo 2 animaciones ( la segunda comienza cuando acaba la primera) pero el segundo onMotionFinished no me lo hace.

He probado a tracear desde dentro de ese onMotionFinished pero solo me devuelve undefined...
Aquí os dejo el código:

Código :

function sale(){
      //transicion de salida
      var tween_texto_out:Tween = new Tween(textoMC, "_x", Regular.easeIn, textoMC._x, texto_x_ini, .5, true);
      var tween_bullet_out:Tween = new Tween(bulletMC, "_x", Regular.easeInOut, bulletMC._x, bullet_x_ini, .5, true);
      
      tween_bullet_out.stop();      
      tween_texto_out.onMotionFinished = function() {         
         tween_bullet_out.start();
      }      
      tween_bullet_out.onMotionFinished = function(){         
         trace("Aquí no funciona : ");         
         textoMC.cajaTexto.textColor = 0xD8D8D0;
         fondoMC.gotoAndStop("off");
      }      
   }

Alguna idea?

Gracias de antemano, como siempre. ^^

Por sebasstian

50 de clabLevel



Genero:Masculino  

Barcelona

firefox
Citar            
MensajeEscrito el 11 Abr 2008 10:42 am
Declara el segundo tween dentro del onMotionFinished del primero

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 11 Abr 2008 10:45 am
Gracias por contestar ta rápido jorge,

el caso es que ya lo probé antes y declarando dentro del primero las segunda Tween simplemente no funciona... :(

Por sebasstian

50 de clabLevel



Genero:Masculino  

Barcelona

firefox
Citar            
MensajeEscrito el 11 Abr 2008 11:13 am
Vale solucionado....uff

Explico un poco.. el caso es q siguiendo la busqueda de una solución, se puede llamar a funciones desde un evento como onMotionFinished usando la clase Delegate. Así que os posteo como queda la cosa:

Código :

import mx.utils.Delegate;

Código :

function sale(){
      //transicion de salida
      var tween_texto_out:Tween = new Tween(textoMC, "_x", Regular.easeIn, textoMC._x, texto_x_ini, .5, true);
      var tween_bullet_out:Tween = new Tween(bulletMC, "_x", Regular.easeInOut, bulletMC._x, bullet_x_ini, .5, true);
      
      tween_bullet_out.stop();
      
      tween_texto_out.onMotionFinished = function() {
         
         tween_bullet_out.start();
      }
      
      
      tween_bullet_out.onMotionFinished = Delegate.create(this, accionRollOut);      
      
   }
function accionRollOver(){
      
      this.textoMC.cajaTexto.textColor = 0x7D7A76;
      //this.textoMC.gotoAndStop("on");
      this.fondoMC.gotoAndStop("on");
      
   }


Espero que si alguien se encuentra con el mismo problema le sirva...

Saludos!!

Por sebasstian

50 de clabLevel



Genero:Masculino  

Barcelona

firefox

 

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