# Loading random external swf - with multiple instaces

**URL:** <https://forum.kirupa.com/t/loading-random-external-swf-with-multiple-instaces/217847>\
**Category:** flash\
**Created:** [March 2, 2007, 12:26pm UTC](https://forum.kirupa.com/t/loading-random-external-swf-with-multiple-instaces/217847 "2007-03-02T12:26:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnybaby](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@johnnybaby](https://forum.kirupa.com/u/johnnybaby)\
**Post date:** [March 2, 2007, 12:26pm UTC](https://forum.kirupa.com/t/loading-random-external-swf-with-multiple-instaces/217847/1 "2007-03-02T12:26:43Z")

</div>

Hi there

I was wondering if there was a way to modify the current tutorial regarding “loading random movie clips from external swfs”, into MC containers on the stage ?

I would like it to do the following

* * *

- Have mulitple instances running without having to set up lots of MC Containers with different names for each one. Each of them loading randomly (not all the same at once)
- Once one external swf finishes the next one starts
- Keep the randomness

The current script looks like this…

filename = [“tubetest.swf”, “tubetest2.swf”, “tubetest3.swf”];  
i = filename.length;  
k = Math.floor(Math.random()\*i);  
loadMovie(filename[k], movieTarget4);

This one plays one of the SWF’s and then stops until you hit refresh on the browser and it will load the next.  
I would like flash to do this itself - as soon as the last movie plays, the next one starts… Is this impossible or is anyone up for the challenge ?

Thanks a million !

Johnnybaby
