Link to home
Start Free TrialLog in
Avatar of harris9999
harris9999Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Image Loop Fade in/out

I'm trying to create a loop which loads images.  The Images fade in/out and stay on the screen for a period of time - 3 seconds.  
I had the fade and interval working on there own, but having trouble pulling it together.

Code should be attached to this message

There is problems inside the rotateImages function.
I can't get the proper movieclip name passed to the fadeMovieClip function.  
There may also be a problem with depths, should I just keep loading clips at the next highest depth?


import mx.transitions.Tween;	
var myImages:Array = ["images/comm1.jpg", "images/comm2.jpg", "images/comm3.jpg"];
var ImageNo:Number = 0
var numImages:Number = myImages.length
 
//function to fade images
function fadeMovieClip(myMovieClip:MovieClip, startAt:Number, endAt:Number):Void {
	trace("Inside Fade Function: Clipname=" + MyMovieClip)
	var myTween:Tween = new Tween(myMovieClip, "_alpha", mx.transitions.easing.None.easeNone, startAt, endAt, 3, true);
}
 
//fadeMovieClip(image_mc1, 100, 0)
 
var intervalId:Number;
var duration:Number = 3000;
//var clip:MovieClip;
 
function rotateImages(image:String) {
 this.createEmptyMovieClip("image_mc" + ImageNo, this.getNextHighestDepth());
 
 clip="image_mc" + ImageNo
 clip._x=20
 image_mc0.loadMovie(image, this)
 trace(clip)
 fadeMovieClip(clip, 100, 0)
 clearInterval(intervalId);
 if(ImageNo+1 < numImages) {
 ImageNo++;
 intervalId = setInterval(this, "rotateImages", duration, myImages[ImageNo]);
 }
}
 
if(intervalId != null) {
 clearInterval(intervalId);
}
 
intervalId = setInterval(this, "rotateImages", duration, myImages[ImageNo]);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Aneesh Chopra
Aneesh Chopra
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial