# Getting MovieClips to play randomly PLEASE HELP

**URL:** https://forum.kirupa.com/t/getting-movieclips-to-play-randomly-please-help/192470
**Category:** flash
**Created:** [June 28, 2006, 8:12pm UTC](https://forum.kirupa.com/t/getting-movieclips-to-play-randomly-please-help/192470 "2006-06-28T20:12:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mcginess13](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@mcginess13](https://forum.kirupa.com/u/mcginess13)
#### Post date: [June 28, 2006, 8:12pm UTC](https://forum.kirupa.com/t/getting-movieclips-to-play-randomly-please-help/192470/1 "2006-06-28T20:12:11Z")

</div>

I posted this in the Flash 8 forum, but wonder if I’ll have better luck in here. I need to get movie clips to play randomly. Currently, I have actionscript on Frame 1, and a movie clips on the stage in Frame 2. Also in each movie clip as the last frame I have “PlayMC();”. Here’s the ActionScript I’m using now…can anyone provide insight?

var myNumber;  
// return a random number  
function getRandomNumber(maximum, minimum) {  
return Math.floor(Math.random()\*maximum)+minimum;  
}  
// play a random movieclip  
function playMC() {  
clearInterval(myInterval);  
myNumber = getRandomNumber(3, 1);  
_root["mov_"+myNumber].gotoAndPlay(2);  
delayMC();  
}  
// call our playMC function every 15sec  
function delayMC() {  
myInterval = setInterval(playMC, 15000);  
}  
// begin our random movieclips  
playMC();
