# Rondomize images at load

**URL:** <https://forum.kirupa.com/t/rondomize-images-at-load/117595>\
**Category:** Uncategorized\
**Created:** [July 28, 2004, 5:35pm UTC](https://forum.kirupa.com/t/rondomize-images-at-load/117595 "2004-07-28T17:35:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxdido](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@maxdido](https://forum.kirupa.com/u/maxdido)\
**Post date:** [July 28, 2004, 5:35pm UTC](https://forum.kirupa.com/t/rondomize-images-at-load/117595/1 "2004-07-28T17:35:04Z")

</div>

i saw this great tutorial about randomizing movieclips : [http://www.kirupa.com/developer/actionscript/loading\_random\_movie.htm](http://www.kirupa.com/developer/actionscript/loading_random_movie.htm)

this is the code that’s being used :

filename = [“circular.swf”, “vibration.swf”, “random\_movement.swf”];  
path = “images/”;  
i = filename.length;  
k = Math.floor(Math.random()\*i);  
loadMovie(path+filename[k], movieTarget);

instead of loading swf files i would like to load images. when i replace the swf files with image files it works great, but i would like to do it a little bit different. my question is… if it’s possible to direct to a directory filled with images so that i don’t have to fill in the images that it can choose from but that it automatically takes a picture that’s in that directory. i thought about the next code but it doesn’t work :

filename = ["\*.jpg"];  
path = “images/”;  
i = filename.length;  
k = Math.floor(Math.random()\*i);  
loadMovie(path+filename[k], movieTarget);

perhaps someone else nows something better.  
thanks,  
max.
