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();
} 