# Random MovieClip script only producing same 3 results

**URL:** <https://forum.kirupa.com/t/random-movieclip-script-only-producing-same-3-results/297494>\
**Category:** flash\
**Created:** [October 3, 2009, 6:42am UTC](https://forum.kirupa.com/t/random-movieclip-script-only-producing-same-3-results/297494 "2009-10-03T06:42:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![junwin](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@junwin](https://forum.kirupa.com/u/junwin)\
**Post date:** [October 3, 2009, 6:42am UTC](https://forum.kirupa.com/t/random-movieclip-script-only-producing-same-3-results/297494/1 "2009-10-03T06:42:23Z")

</div>

i have a collection of movie clips (mc0, mc1, mc2…etc etc), and when motion is detected  
on a webcam, one of these clips is shown on the stage.

however, for some reason only mc0, mc1 and mc2 are being displayed,  
and i cannot get mc3, mc4 or any others to be chosen.

> ```
> import flash.filters.*
> 
> ```

// Assumes a Video object named “myVideoObject” is on the Stage  
active\_cam = Camera.get();

filterList = [  
/\* 0 _/ “multiply”,  
/_ 1 _/ “multiply”,  
/_ 2 _/ “multiply”,  
/_ 3 _/ “multiply”,  
/_ 4 \*/ “multiply”  
];

positionList = [  
/\* 0 _/ {\_x: 512, \_y: 288},  
/_ 1 _/ {\_x: 512, \_y: 288},  
/_ 2 _/ {\_x: 512, \_y: 288},  
/_ 3 _/ {\_x: 512, \_y: 288},  
/_ 4 \*/ {\_x: 512, \_y: 288}  
];

myVideoObject.attachVideo(active\_cam);  
active\_cam.setMotionLevel(95, 100);  
active\_cam.onActivity = function(mode)  
{  
trace(mode);  
var randId = Math.floor(Math.random() \* 5);

```
var init = positionList[randId];
/* old init... {_x: Math.random() * _root._width, _y:Math.random() * _root._height}; */
var depth = _root.getNextHighestDepth();
var movieId = "mc" + randId;
if(mode) {
    var mc = _root.attachMovie(movieId, movieId + depth, depth, init);
    mc.blendMode = _root.filterList[randId];
}

```

}

I had the first three working fine, so when i added 2 more to the Filter and position Lists, and changed  
the Mathrandom mutliplier to 5 instead of 3, i thought that would work, what else to i have to do / How can i get all 5 clips to show up ?
