# Load random movie based on interval time

**URL:** <https://forum.kirupa.com/t/load-random-movie-based-on-interval-time/62675>\
**Category:** Uncategorized\
**Created:** [August 30, 2004, 2:22pm UTC](https://forum.kirupa.com/t/load-random-movie-based-on-interval-time/62675 "2004-08-30T14:22:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gogetsome](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gogetsome](https://forum.kirupa.com/u/gogetsome)\
**Post date:** [August 30, 2004, 2:22pm UTC](https://forum.kirupa.com/t/load-random-movie-based-on-interval-time/62675/1 "2004-08-30T14:22:07Z")

</div>

[font=Arial]Hey all, Does anyone know how to correctly load a random movie into an MC based on an interval time? For example: I have three movies. 1.swf, 2.swf and 3.swf that will load into an MC every 10 secs. It should be a completely random event not based on a page refreash. I have attached the code that I’m working with below. The issue that I’m having is that sometimes a movie will load in repeatedly (2-3 times). The movies are roughly the same size.

function randommovie() {  
filename = [“1.swf”, “2.swf”, “3.swf”];  
path = “banners/champions/”;  
i = filename.length;  
k = Math.floor(Math.random()\*i);  
loadMovie(path+filename[k], \_root.championStage);  
}  
randommovie();  
setInterval(randommovie, 10000); [/font]
