Hi,
I have a FLA doc which features a 'shuffle effect' between two images assigned in an external XML file. However, I would like to modify the code so that it just has a simple fading effect but between three images (tho needs to be easy to add more in future).
My ActionScript knowledge is kinda lacking but I had a go at modifying some of the code. To my surprise it actually nearly works! It just messes up the first time it runs and skips one of the images, but after that works perfectly. So I guess its just missing an initial condition statement? Heres the code Ive got so far:
/////////////////////////////////////////Shuffle Effect////////////////////////////////
function Shuffle():void
{
var anotherTimer:Timer= new Timer(5000);
anotherTimer.addEventListener(TimerEvent.TIMER, changeAnotherPic)
anotherTimer.start();
}
function changeAnotherPic(e:TimerEvent)
{
var pic1 = another_group.getChildAt(another_group.numChildren-1);
var pic2 = another_group.getChildAt(another_group.numChildren-2);
TweenMax.to(pic1,0.5,{alpha:1,onComplete:resetImg1,onCompleteParams:[pic1]});
TweenMax.to(pic2,0.5,{alpha:0,onComplete:resetImg2,onCompleteParams:[pic2]});
}
function resetImg1(img:MovieClip)
{
another_group.setChildIndex(img,0);
TweenMax.to(img,0.5,{alpha:0,onCompleteParams:[img]});
}
function resetImg2(img:MovieClip)
{
another_group.setChildIndex(img,another_group.numChildren-1);
TweenMax.to(img,0.5,{alpha:1});
}
function txt_Click(e:MouseEvent):void{
var txt_name = e.currentTarget.name;
if(txt_name == "txt_girl")
navigateToURL(new URLRequest(XMLList4.forHerTEXT.link),"_self");
else
navigateToURL(new URLRequest(XMLList4.forHimTEXT.link),"_self");
}
///////////////////////////////////////////////////////////////////////////////////////
Please help!
Thanks, Ben.