Actionscript 3 slide image animation problem

Hi guys,

I’m a new on Action script 3.0.
I would like ask about slide image show animation.
The slide show is a part of one big site. And following scripts are main code of slide show that somebody already made that we decompiled flash swf. We lost the original fla file in 4 years ago and we can’t find the flasher who made this site. :unamused:
Then we have to edit this file now. :sob:
I want to add alpha “fade in” , “fade out” function when images play.
I don’t know how to add alpha fade animation with this.
Please help me and my team. Thank you. :

import gs.TweenLite;
import gs.easing.*;

import flash.events.MouseEvent;
import flash.utils.setTimeout;
import flash.utils.setInterval;
import flash.utils.clearInterval;

var idx:int;
var timeshift:int = 6000; 
var sto:uint;

btn_1.addEventListener( MouseEvent.CLICK , moveFun );
btn_2.addEventListener( MouseEvent.CLICK , moveFun );
btn_3.addEventListener( MouseEvent.CLICK , moveFun ); 

swfIni();

function moveFun( e:MouseEvent ):void{
	switch(e.target.name.substr(4)){
		case "1":
			gotoAndStop(1);
			clearInterval(sto);
			idx = 2;
			sto = setTimeout(gogo,timeshift); 
			break;
		case "2":
			gotoAndStop(2);
			clearInterval(sto);
			idx = 3;
			sto = setTimeout(gogo,timeshift);			
			break;
		case "3":
			gotoAndStop(3);
			clearInterval(sto);
			idx = 1;
			sto = setTimeout(loop,timeshift);
			break;
	}
}

function loop() : void
{
	dispatchEvent(new Event(Event.COMPLETE));
}

function swfIni() : void
{
	clearInterval(sto);
	idx = 1;
	gogo();
}

function gogo( ) : void
{
	gotoAndStop(idx);
	clearInterval(sto);
	idx++;
	if(idx > 3){
		idx = 1;
		sto = setTimeout(loop,timeshift);
	}else{
		sto = setTimeout(gogo,timeshift);
	}

}

stop();

Since this is a decompile, you probably already cleaned out all the garbage code that comes with the decompilation?

The gs.Tweenlite is greensock tweening. He has quite a few examples how to use his library on his page(The other imports should be standard for a flash file):
https://greensock.com/gsap-as or http://greensock.com/asdocs/

Thank you for the help Linusj. Yes, we cleaned out the garbage codes from decompile file. Then, we are trying to add the alpha fade animation without any editing, because this file is working on empty movie clip of parents swf that we don’t have original fla file either. Actually I tried make all new one but it didn’t work with the parents swf. This one is working clearly with the parents swf except alpha fade animation.

Ok, when you switch frame in the timeline, you don’t have any opportunity to fade down, so you need to change in the gogo function. The gotoAndStop should be put in a callback from a tweenlite fading down. Only after the movieclip at that frame has faded to zero, you allow it to change frame. This is somewhat problematic since you will get a fade-in fade-out with no overlap.

Fade in is easier, since all you do is set the current frame-alpha to zero and fade up.

I don’t remember exactly, but I think you have to get hold of the movieclip name or reference on each frame?