# Why doesn't this FOR loop work!?

**URL:** <https://forum.kirupa.com/t/why-doesnt-this-for-loop-work/78344>\
**Category:** Uncategorized\
**Created:** [February 3, 2005, 6:11pm UTC](https://forum.kirupa.com/t/why-doesnt-this-for-loop-work/78344 "2005-02-03T18:11:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![calitswa](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@calitswa](https://forum.kirupa.com/u/calitswa)\
**Post date:** [February 3, 2005, 6:11pm UTC](https://forum.kirupa.com/t/why-doesnt-this-for-loop-work/78344/1 "2005-02-03T18:11:38Z")

</div>

I am using some code from one of the Kirupa random movie tutorials to load a random movie upon loading a page…problem is, I want it to continuously cycle through a number of movie clips (according to variable ‘i’).

This is the code example:

```auto
 filename = ["fuji.swf", "calient.swf"];
i = filename.length;
k = Math.floor(Math.random()*i);
for (i=0; i <= 3;) {
loadMovie(filename[k], movieTarget);
i++;
} 

```

Anyone have any clues? One of the movies stops upon reaching the end of its timeline, the other one will continuously loop.
