Random video actionscript

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/”;
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], movieTarget);

Thanks in advance for your help.
Heather