# Simple Animated Gif Style Image Fader in Actionscript!

**URL:** <https://forum.kirupa.com/t/simple-animated-gif-style-image-fader-in-actionscript/213932>\
**Category:** flash\
**Created:** [January 24, 2007, 11:49am UTC](https://forum.kirupa.com/t/simple-animated-gif-style-image-fader-in-actionscript/213932 "2007-01-24T11:49:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![new\_AS](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@new\_AS](https://forum.kirupa.com/u/new_AS)\
**Post date:** [January 24, 2007, 11:49am UTC](https://forum.kirupa.com/t/simple-animated-gif-style-image-fader-in-actionscript/213932/1 "2007-01-24T11:49:17Z")

</div>

Hi there,

This may seem veru basic but i am new to this!

I am aiming to create a looping array of images so that each fades in and fades out again … here is the code i have so far … it works EXCEPT … it stops at the end of the array and appears to jump or hop a little between images … want it to be smoother.

Can anyone help me? I am in need of a helping hand!

```auto
 
var aImages:Array = new Array("flashcontent.png", "flashcontent2.png", "flashcontent3.png");[/quote][quote]
var imageFolder = "../images/";
var fadeRate:Number = 1;
var imageCounter:Number = 0;
 
 
function imageFade (selectedImage) {
 
onEnterFrame = function()
{
selectedImage._alpha += fadeRate;
if (selectedImage._alpha > 100 )
{
fadeRate *= -1;
}
if (selectedImage._alpha < 6)
{
imageCounter++;
if (imageCounter>aImages.length-1)
{
onEnterFrame = null;
selectedImage._alpha = 0;
break;
}
else
{
mcContainer.loadMovie(imageFolder+aImages[imageCounter]); 
fadeRate *=-1;
}
}
}
 
}
 
mcContainer._alpha = 12;
mcContainer.loadMovie(imageFolder+aImages[0]);
imageFade(mcContainer);

```
