# How do I stop the movie after last image loads?

**URL:** <https://forum.kirupa.com/t/how-do-i-stop-the-movie-after-last-image-loads/188250>\
**Category:** flash\
**Created:** [May 5, 2006, 5:57pm UTC](https://forum.kirupa.com/t/how-do-i-stop-the-movie-after-last-image-loads/188250 "2006-05-05T17:57:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jillymo](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@jillymo](https://forum.kirupa.com/u/jillymo)\
**Post date:** [May 5, 2006, 5:57pm UTC](https://forum.kirupa.com/t/how-do-i-stop-the-movie-after-last-image-loads/188250/1 "2006-05-05T17:57:59Z")

</div>

I am using this great script that was provided by Claudio in this thread:  
[http://www.kirupa.com/forum/showthre...0jpeg%20fad](http://www.kirupa.com/forum/showthre...0jpeg%20fad) e

I would like for it to load my final picture (which happens to be rms16)  
and then just stop rather than loop back to the first loaded jpg. Things I am trying are not working.

```auto
movies_array = ["rms01", "rms02", "rms03", "rms04", "rms05", "rms06", "rms07", "rms08", "rms09", "rms10", "rms11", "rms12", "rms13", "rms14", "rms15", "rms16"];//array containing your movie files without the .swf extension
index = 0;
speed = 10;//fading speed, higher number = faster speed
seconds = 4;//seconds before the picture fadeout
this.createEmptyMovieClip("container", 0);
this.createEmptyMovieClip("loader", 1);
function preload() {
        loader.onEnterFrame = function() {
                var l, t;
                l = container.getBytesLoaded();
                t = container.getBytesTotal();
                if (t && l == t) {
                        delete this.onEnterFrame;
                        container._alpha = 0;
                        my_interval = setInterval(fadeIn, 50);
                }
        };
}
function fadeIn() {
        if (container._alpha>100) {
                clearInterval(my_interval);
                my_interval = setInterval(pause, seconds*1000);
        } else {
                container._alpha += speed;
        }
}
function pause() {
        clearInterval(my_interval);
        my_interval = setInterval(fadeOut, 50);
}
function fadeOut() {
        if (container._alpha<0) {
                clearInterval(my_interval);
                loadPicture();
        } else {
                container._alpha -= speed;
        }
}
function loadPicture() {
        container.loadMovie(movies_array[index]+".jpg");
        preload();
        index == movies_array.length-1 ? index=0 : ++index;
}
loadPicture();

```
