Comunidad de diseño web y desarrollo en internet online

tengo problemas con TweenPlugin

Citar            
MensajeEscrito el 08 May 2013 12:53 am
hola.

estuve revisando el código para mi presentación y con los botones que van al fotograma 1 y 21 están perfectos, con los addChild se quedan visibles los mc que quiero y con la función crossfade vinculo los
mc de la var.arr array con sus correpondientes botones ejem. (inicio_final.image1_btn.ID = 0; ) y empleo alfa y cambio de tamaño para la aparicion.

el problema me llega cuando quiero que mis otros botones funcionen como el crossfade (botones_flechas.b2, botones_flechas.b1, back_next.nextp_btn, back_next.backp_btn) y es que sonara lerdo pero no se como escribir la función nextFrame/prevFrame con el tween plugin. ya que son 21 mc sobre los que avanzara o retrocedera el boton. y como tengo escrita la funcion:

back_next.backp_btn.addEventListener(MouseEvent.CLICK, atraFrame);
function atraFrame(e:MouseEvent):void{
prevFrame();


esta mal porque no obedece las variables ni los adchill.
saludos.

Código ActionScript :

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;


TweenPlugin.activate([ScalePlugin]);

var clips_arr:Array = [image1, image2, image3, image4, image5, image6, image7, image8, image9, image10, image11, image12, image13, image14, image15, image16, image17, image18, image19, image20, image21];


inicio_final.image1_btn.ID = 0;
inicio_final.image21_btn.ID = 20;


inicio_final.buttonMode = true;

inicio_final.addEventListener(MouseEvent.CLICK, crossFade);
inicio_final.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
inicio_final.addEventListener(MouseEvent.MOUSE_OUT, btnOut);

//this variable stores a reference to the currently visible clip
var currentClip:MovieClip = clips_arr[0];

function crossFade(e:MouseEvent):void{
   
   //create a reference to the movieclip related to the button you just clicked
   var thisBtnsMovie:MovieClip = clips_arr[e.target.ID]
   trace(thisBtnsMovie.name);
   //make sure the currentClip isn't related to the button you just clicked
   if(currentClip != thisBtnsMovie){
      
      //hide the current clip
      TweenLite.to(currentClip, .5, {autoAlpha:0, scale:2, ease:Quad.easeIn});
      
      //show the clip related to the btn you just pressed
      TweenMax.fromTo(thisBtnsMovie, .8, {scale:0}, {autoAlpha:1, scale:1, delay:.2});
      }      
      
   //reset currentClip to reflect the clip related to the button you just clicked   
   currentClip = thisBtnsMovie;   
   addChild(currentClip);
   addChild(fondo);
   addChild(inicio_final);
   addChild(back_next);
   addChild(botones_flechas);
   

   }

function btnOver(e:MouseEvent):void{
   TweenMax.to(e.target, .5, {tint:0xffffff});
   }
   
function btnOut(e:MouseEvent):void{
   TweenMax.to(e.target, .5, {tint:null});
   }   
   stop();
botones_flechas.b2_btn.addEventListener(MouseEvent.CLICK, avanzarFrame);
function avanzarFrame(e:MouseEvent):void{
    nextFrame();
}
botones_flechas.b1_btn.addEventListener(MouseEvent.CLICK, retrocederFrame);
function retrocederFrame(e:MouseEvent):void{
    prevFrame();
}
back_next.nextp_btn.addEventListener(MouseEvent.CLICK, siguientFrame);
function siguientFrame(e:MouseEvent):void{
    nextFrame();
}
back_next.backp_btn.addEventListener(MouseEvent.CLICK, atraFrame);
function atraFrame(e:MouseEvent):void{
    prevFrame();
}

Por david22

1 de clabLevel



 

chrome
Citar            
MensajeEscrito el 08 May 2013 03:32 pm
ok voy a tratar de explicarme mejor

Código ActionScript :

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;


TweenPlugin.activate([ScalePlugin]);

//primero hago una matriz donde colocare los movie clips que quiero que aparezcan, estos actuaran como diapositivas
var clips_arr:Array = [image1, image2, image3, image4, image5, image6, image7, image8, image9, image10, image11, image12, image13, image14, image15, image16, image17, image18, image19, image20, image21];

//ahora la matriz funciona como un indice de aparicion, cuando tengo botones que quiero que vayan a un movieclip especifico los relaciono
inicio_final.image1_btn.ID = 0;
inicio_final.image21_btn.ID = 20;
//image1 = 0, image2 = 1... es como cuando entras a un hotel y te recibe primero recepcion luego planta 1 etc.. 

inicio_final.buttonMode = true;

//ponemos las funciones (over y out son los brillitos del boton) como tengo mis botones dentro de otro movie clip basta con animar el mc contenedor
inicio_final.addEventListener(MouseEvent.CLICK, crossFade);
inicio_final.addEventListener(MouseEvent.MOUSE_OVER, btnOver);
inicio_final.addEventListener(MouseEvent.MOUSE_OUT, btnOut);

//crossfade hara que el boton vaya al movieclip que ya espcificamos arriba mediante la variables currentClip thisBtnsMovie
//this variable stores a reference to the currently visible clip
var currentClip:MovieClip = clips_arr[0];

function crossFade(e:MouseEvent):void{
   
   //create a reference to the movieclip related to the button you just clicked
   var thisBtnsMovie:MovieClip = clips_arr[e.target.ID]
   trace(thisBtnsMovie.name);
   //make sure the currentClip isn't related to the button you just clicked
   if(currentClip != thisBtnsMovie){
      
      //con esto current clip desaparecera cuando cambie de boton
      //hide the current clip
      TweenLite.to(currentClip, .5, {autoAlpha:0, scale:0, ease:Quad.easeIn});
      
      //con esto el clip aparecera en forma de zoon
      //show the clip related to the btn you just pressed
      TweenMax.fromTo(thisBtnsMovie, .8, {scale:2}, {autoAlpha:1, scale:1, delay:.2});
      }      
      
   //ahora esto funciona sobre los movie clips y no sobre los frame asi que si tengo en el fotograma 1 60 layers y mi movieclip esta en el 35 el boton solo hara aparecer el movieclip, entonces si yo quiero que otros elementos se sigan viendo como un banner u otros botones los meto en un addchild
   //acomoda los addchild por orden ejemplo si current clip que es una diapositiva y abarca todo el escenario lo pusiera al final, me taparia los botones cuando realize la animacion
   //reset currentClip to reflect the clip related to the button you just clicked   
   currentClip = thisBtnsMovie;   
   addChild(currentClip);
   addChild(fondo);
   addChild(inicio_final);
   addChild(back_next);
   addChild(botones_flechas);
   
   //mi problema es que quiero hacer nuevos botones pero que estos recorran toda la matriz y no un movieclip en especifico (click va aimage1 otro click y va a image2...) si alguien me puede ayudar se lo agradeceria mucho

   }

function btnOver(e:MouseEvent):void{
   TweenMax.to(e.target, .5, {tint:0xffffff});
   }
   
function btnOut(e:MouseEvent):void{
   TweenMax.to(e.target, .5, {tint:null});
   }   

Por david22

1 de clabLevel



 

chrome
Citar            
MensajeEscrito el 09 May 2013 09:49 pm
Hola David, lei tu consulta pero no puedo entender bien cual es el problema que tenes, el codigo te lo entiendo pero no el problema, no estoy muy acostumbrado a usar el ide de flash de todas maneras, pero si podes explicarmelo de otra manera veo si te puedo ayudar. Un saludo

Por plancha

33 de clabLevel



 

chrome

 

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