# Loading Random Images - Problem

**URL:** https://forum.kirupa.com/t/loading-random-images-problem/182087
**Category:** flash
**Created:** [March 15, 2006, 1:31pm UTC](https://forum.kirupa.com/t/loading-random-images-problem/182087 "2006-03-15T13:31:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![larsk](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@larsk](https://forum.kirupa.com/u/larsk)
#### Post date: [March 15, 2006, 1:31pm UTC](https://forum.kirupa.com/t/loading-random-images-problem/182087/1 "2006-03-15T13:31:57Z")

</div>

Hi,  
I want an image being randomly loaded out of a folder, each time you access or reload my web-page.  
I use this code:

filename = [“image1.swf”, “image2.swf”, “image3.swf”];  
path = “file:///folder\_path”;  
i = filename.length;  
k = Math.floor(Math.random()\*i);  
loadMovie(path+filename[k], movieTarget);

It works fine when I test the movie within Flash; but it is not working at all in any browser I test the movie in. I use Dreamweaver for the test.  
I am really frustrated about this. If anybody can give me a hint what I`m doing wrong, or maybe a different actionscript code that solves my problem, I´d be very glad.

Thank you very much in advance  
Bye  
Lars
