# Playing Random Movie Clips on Main Timeline

**URL:** https://forum.kirupa.com/t/playing-random-movie-clips-on-main-timeline/282184
**Category:** flash
**Created:** [February 18, 2009, 6:33pm UTC](https://forum.kirupa.com/t/playing-random-movie-clips-on-main-timeline/282184 "2009-02-18T18:33:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![cigi223](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@cigi223](https://forum.kirupa.com/u/cigi223)
#### Post date: [February 18, 2009, 6:33pm UTC](https://forum.kirupa.com/t/playing-random-movie-clips-on-main-timeline/282184/1 "2009-02-18T18:33:20Z")

</div>

Hi guys,

What I would like to do is play ramdom movie clips on my main time line. I’ve tried using the below code, but it does not work:

```auto
 
var frameList:Array = [1, 2];

var i:int = Math.random() * frameList.length;

"mc" + frameList*.gotoAndPlay(1);

```

My movie clips are named “mc1, mc2” etc.  
I’ve got them on a layer named “BG” and each movie clip is in a key frame.  
The ActionScript is on a seperate layer named “AS”.

Can someone help me please, or is there a better way to do this?

Many thanks
