# Help! With looping an image loader!

**URL:** <https://forum.kirupa.com/t/help-with-looping-an-image-loader/166424>\
**Category:** Uncategorized\
**Created:** [October 19, 2005, 8:19pm UTC](https://forum.kirupa.com/t/help-with-looping-an-image-loader/166424 "2005-10-19T20:19:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![prototype](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@prototype](https://forum.kirupa.com/u/prototype)\
**Post date:** [October 19, 2005, 8:19pm UTC](https://forum.kirupa.com/t/help-with-looping-an-image-loader/166424/1 "2005-10-19T20:19:21Z")

</div>

Trying hard to teach myself actionscripting so forgive my code & structure.

I want to load an external image continuously. I have the image names in an array. I want to load one image, fade in, fade out and then load the next image. What is happening is my loop goes through the entire array and only loads the last image, then stops. Thanks for any help!

my code:

// Import Tween classes  
import mx.transitions.Tween;  
import mx.transitions.easing.\*;

// Create holder  
this.createEmptyMovieClip(“photo\_mc”, 1);

```
// Array of photo names
var imgNumber:Array = ["01", "02", "03", "04", "05", "06"]; // images to load
// sequence through array
for (var i = 0; i &lt; imgNumber.length; i++) {
// what image is loading?
trace("image # " + imgNumber*);
// Set alpha to 0
photo_mc._alpha = 0;
// Load image into MovieClip
photo_mc.loadMovie("images/"+imgNumber*+".jpg");
// Ease alpha to 100
var showPhoto:Object = new Tween(photo_mc, "_alpha", Strong.easeOut, 0, 100, 2, true);
// When tween is finished, take alpha to zero
showPhoto.onMotionFinished = function():Void {
// Ease alpha to zero
showPhoto.continueTo(0, 3);
}

```

}
