# Random video actionscript

**URL:** <https://forum.kirupa.com/t/random-video-actionscript/267550>\
**Category:** Uncategorized\
**Created:** [August 2, 2008, 7:01pm UTC](https://forum.kirupa.com/t/random-video-actionscript/267550 "2008-08-02T19:01:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dirtpatch](https://avatars.discourse-cdn.com/v4/letter/d/5fc32e/32.png) [@dirtpatch](https://forum.kirupa.com/u/dirtpatch)\
**Post date:** [August 2, 2008, 7:01pm UTC](https://forum.kirupa.com/t/random-video-actionscript/267550/1 "2008-08-02T19:01:54Z")

</div>

i used the random video actionscript i found in a tutorial on here, however it only is random if you refresh the page. Not only that, the video plays for 2 seconds then stops, I am a bit confused. I was looking for something that was more like this:

video 1 loads, when it stops playing, video 5 loads randomly and continues the pattern. If anyone can help me out with this that would be great.

This is the current actionscript I have:

filename = [“1.swf”, “2.swf”, “3.swf”];  
path = “[http://www.fivedoublezero.com/sprintcar/movies/](http://www.fivedoublezero.com/sprintcar/movies/)”;  
i = filename.length;  
k = Math.floor(Math.random()\*i);  
loadMovie(path+filename[k], movieTarget);

Thanks in advance for your help.  
Heather
