# Loading random movies

**URL:** <https://forum.kirupa.com/t/loading-random-movies/102192>\
**Category:** Uncategorized\
**Created:** [February 20, 2004, 7:03pm UTC](https://forum.kirupa.com/t/loading-random-movies/102192 "2004-02-20T19:03:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigbadmilkman](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bigbadmilkman](https://forum.kirupa.com/u/bigbadmilkman)\
**Post date:** [February 20, 2004, 7:03pm UTC](https://forum.kirupa.com/t/loading-random-movies/102192/1 "2004-02-20T19:03:59Z")

</div>

Now before some smartass refers me to the random movie tutorial listen to my situation.

I have 5 movies within one flash file, and when the user clicks a button i want a movie to be loaded at random.

What would be the button code for this?

---

<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:** [February 20, 2004, 7:09pm UTC](https://forum.kirupa.com/t/loading-random-movies/102192/2 "2004-02-20T19:09:53Z")

</div>

[http://www.kirupaforum.com/forums/showthread.php?s=&postid=300373#post300373](http://www.kirupaforum.com/forums/showthread.php?s=&postid=300373#post300373)

---

<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:** [February 20, 2004, 8:18pm UTC](https://forum.kirupa.com/t/loading-random-movies/102192/3 "2004-02-20T20:18:38Z")

</div>

Thanks claudio, now I have the following code

on (release){  
movies\_array = [“Q1.swf”,“manny.swf”];  
loadMovieNum(movies\_array[Math.floor(Math.random()\*movies\_array.length)], 0);  
}

I have placed this code in a button, and it works fine, but it opens in a new window, and i want it to load into content, how do i modify this code so that it loads the random movies into content.

Could I use \_root.contents.loadMovie, if so where would I put this in the code above?

Thanks for ur help in support by the way!
