# Random Image Loop?

**URL:** <https://forum.kirupa.com/t/random-image-loop/145187>\
**Category:** Uncategorized\
**Created:** [April 20, 2005, 4:24pm UTC](https://forum.kirupa.com/t/random-image-loop/145187 "2005-04-20T16:24:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Exuk](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/exuk/32/681_2.png) [@Exuk](https://forum.kirupa.com/u/Exuk)\
**Post date:** [April 20, 2005, 4:24pm UTC](https://forum.kirupa.com/t/random-image-loop/145187/1 "2005-04-20T16:24:54Z")

</div>

I am building a project that loads 30 images in to empty movie clips. I want one of the images to apear on top randomly. What is happening now is that the first swf in my loop always shows up on top.

Here is a link to waht i am doing:  
[http://www.0-style.com/files/](http://www.0-style.com/files/)

Here is some code i am working with:

```auto
// Random range
function randRange(min:Number, max:Number):Number {
        var randomNum:Number = Math.round(Math.random()*(max-min))+min;
        return randomNum;
}

// Load External files
for (i=1; i<=30; i++) {
        createEmptyMovieClip("img"+i+"_mc", randRange(101, 99999));
        loadMovie("images/"+i+".swf", "img"+i+"_mc");
}

```
