Trouble with array/loop/fade
Hey guys/gals, I am new to actionscript and have used kglad's example to create images thet cycle through from an array. I have to figure out how to make them fade in and out between images and then loop continuously. I am taking an online class and have had some experience with actionscript (minimal to say the least) but I don't know where I need to put my fadeIn tween. Here is the code:
var count:int;
var imageArray:Array = new Array("image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg", "image10.jpg", "image11.jpg", "image12.jpg", "image13.jpg", "image14.jpg", "image15.jpg", "image16.jpg");
var ldr0:Loader=new Loader();
ldr0.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompleteF);
var ldr1:Loader=new Loader();
ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompleteF);
play_btn.addEventListener(MouseEvent.CLICK,clickF);
function clickF(e:MouseEvent):void{
count=0;
loadF();
}
function loadF():void{
addChild(this["ldr"+count%2])
this["ldr"+count%2].load(new URLRequest(imageArray[count]));
}
function loadCompleteF(e:Event):void{
// increment count
count++;
// check if the last has loaded
if(count<imageArray.length){
// if not clear the content out of the next loader.
if(this["ldr"+count%2].content){
this["ldr"+count%2].unloadAndStop();
}
// and call loadF so the next loader can load the next image in the array
loadF();
} else {
// if the last has loaded.
// last load completed
}
}
Any help would be appreciated.
Shannon
