# Random Movie Picker?

**URL:** <https://forum.kirupa.com/t/random-movie-picker/199353>\
**Category:** flash\
**Created:** [September 1, 2006, 4:20pm UTC](https://forum.kirupa.com/t/random-movie-picker/199353 "2006-09-01T16:20:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashsandy](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@flashsandy](https://forum.kirupa.com/u/flashsandy)\
**Post date:** [September 1, 2006, 4:20pm UTC](https://forum.kirupa.com/t/random-movie-picker/199353/1 "2006-09-01T16:20:39Z")

</div>

hello everyone

so i am just trying to have a random movie play everytime someone comes to the website…and as usual i am trying to cobble it all together from bits of actionscript that worked in so other sitatuation which was similar but of course different in one particular and deal-breaking way…

everytime the site is loaded or the frame visited i want it to pick a movie from a choice of ten - check it wasn’t the same as before and then when that movie is finished pick a new one…

the code i have right now is this…

```auto
myMovie = new Array();
myMovie[0] = {name:"headache.swf"};
myMovie[1] = {name:"reflux.swf"};
myMovie[2] = {name:"sports.swf"};

function playMovie(MovieNum) {
    this.MovieNum = MovieNum;
	headache.gotoAndPlay(2);
    };

function selectNextMovie() {
    nextMovie = random(myMovie.length);
    if (nextMovie != oldMovie) {
        playMovie(nextMovie);
        oldMovie = nextMovie;
    } else {
        selectNextMovie();
    }
}

```

where it says ‘headache’ is where i want to put the variable that corresponds to the movie instance i want to target - taken from the array…

i’m kinda lost at the moment - i could achieve the same result by making lots of different frames and using this ‘choice’ thing that i have seen but i want to try do it economically…

any help people?

thanks,  
sandy

🙂
