# Randomly Displaying Movie Clips

**URL:** <https://forum.kirupa.com/t/randomly-displaying-movie-clips/326769>\
**Category:** flash\
**Created:** [January 11, 2012, 7:16am UTC](https://forum.kirupa.com/t/randomly-displaying-movie-clips/326769 "2012-01-11T07:16:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoWeb](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@NeoWeb](https://forum.kirupa.com/u/NeoWeb)\
**Post date:** [January 11, 2012, 7:16am UTC](https://forum.kirupa.com/t/randomly-displaying-movie-clips/326769/1 "2012-01-11T07:16:36Z")

</div>

Hi all,  
I would like to know how to randomly display movie clips on my website . After doing some research I’ve found the following scripts that’s supposed to do that:

filename = [“circular.swf”, “vibration.swf”, “random\_movement.swf”];  
path = “[http://www.kirupa.com/developer/actionscript/animation/](http://www.kirupa.com/developer/actionscript/animation/)”;  
i = filename.length;  
k = Math.floor(Math.random()\*i);  
loadMovie(path+filename[k], movieTarget);

I have just two questions regarding the script above;

1. What is movieTarget, is it a built in variable or is it a user defined variable?
2. Can the script above play movie clips that are on different layers and if not how can I do that?

Thank you in advance for your response.
