# Help with loading random images

**URL:** <https://forum.kirupa.com/t/help-with-loading-random-images/55985>\
**Category:** Uncategorized\
**Created:** [June 29, 2004, 5:33pm UTC](https://forum.kirupa.com/t/help-with-loading-random-images/55985 "2004-06-29T17:33:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![afmaury](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@afmaury](https://forum.kirupa.com/u/afmaury)\
**Post date:** [June 29, 2004, 5:33pm UTC](https://forum.kirupa.com/t/help-with-loading-random-images/55985/1 "2004-06-29T17:33:24Z")

</div>

I have a series of jpg images that I want to load randomly onto my main movie. I am not sure how to make it so that once one of the images has been loaded, that particular image does not get chosen again.

I am not sure if this is very clear so I will try to give an example. Lets say I have 4 images name 1.jpg, 2.jpg, 3.jpg, and 4.jpg. I have 4 spaces on my main movie that I want to each hold one of the images. If the first slot randomly gets 3.jpg, then that image should not be chosen again.

Right now, I am waiting for my computer to get back to me since it is being repaired but I just want to plan out some changes/additions that I would like to make to a site. Any help would really be appreciated. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2004, 4:35am UTC](https://forum.kirupa.com/t/help-with-loading-random-images/55985/2 "2004-07-19T04:35:56Z")

</div>

okay…i am able to randomized the array of images but I am having trouble displaying them. There are a total of 49 images so I was looking to write a function to load the images using a for loop.

Here’s what I am using right now:

> Array.prototype.loadImages=function(){  
> for(j=0;j\<this.length;j++){  
> \_root.createEmptyMovieClip((“movieclip”+j),1);  
> loadMovie(\_root.pathToPics+arr1[j], (“movieclip”+j);  
> }  
> }

I need to assign .\_x values to each empty movie clip as well but I don’t know how to write the code when I want each clip to have a different name.

Anyone got some ideas?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2004, 4:06pm UTC](https://forum.kirupa.com/t/help-with-loading-random-images/55985/3 "2004-07-19T16:06:07Z")

</div>

do the empty clips get deleted once I loop through that for loop?
