# Image Gallery -- issue transitioning between images

**URL:** <https://forum.kirupa.com/t/image-gallery-issue-transitioning-between-images/174219>\
**Category:** flash\
**Created:** [January 3, 2006, 10:06pm UTC](https://forum.kirupa.com/t/image-gallery-issue-transitioning-between-images/174219 "2006-01-03T22:06:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![developmental](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@developmental](https://forum.kirupa.com/u/developmental)\
**Post date:** [January 3, 2006, 10:06pm UTC](https://forum.kirupa.com/t/image-gallery-issue-transitioning-between-images/174219/1 "2006-01-03T22:06:57Z")

</div>

I have an image gallery that is supposed to load an image pause on that image while loading the next and then fade out/fade in simultaneously. The script seems right to me except when it comes to which function is supposed to run mc\_01up or mc\_02up.

```auto
         if (current == 1) {
            mc_02_up();
        } else {
            mc_01_up();
        }

```

Any help would be greatly appreciated.

-developmental

–Script–

```auto
//setup
delay = 3000;
filename = ["01.jpg", "02.jpg", "03.jpg"];
path1 = "http://130public.net/test_area/image_gallery/images/welcome/01/";
path2 = "http://130public.net/test_area/image_gallery/images/welcome/02/";
i = filename.length;
k = Math.floor(Math.random()*i);
//
mc_01.onEnterFrame = function() {
    filesize = mc_01.getBytesTotal();
    loaded = mc_01.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
        preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
        preloader._visible = false;
    }
};
//
function first_image() {
    mc_01._alpha = 0;
    mc_01.loadMovie(path1+filename[k], 0);
    var current = 1;
    if (loaded == filesize) {
        fadein = new mx.transitions.Tween(mc_01, "_alpha", null, this._alpha, 100, 10, false);
        slideshow();
    }
}
//
function slideshow() {
    myInterval = setInterval(pause_slideshow, delay);
    function pause_slideshow() {
        clearInterval(myInterval);
        if (current == 1) {
            mc_02_up();
        } else {
            mc_01_up();
        }
    }
}
//
function mc_01_up() {
    var current = 1;
    var fadeListener:Object = new Object();
    fadeListener.onMotionFinished = function() {
        mc_02.loadMovie(path2+filename[k], 0);
        mc_02.onLoad = slideshow();
    };
    fadein = new mx.transitions.Tween(mc_01, "_alpha", null, this._alpha, 100, 10, false);
    fadeout = new mx.transitions.Tween(mc_02, "_alpha", null, this._alpha, 0, 10, false);
    fadeout.addListener(fadeListener);
}
//
function mc_02_up() {
    var current = 2;
    var fadeListener:Object = new Object();
    fadeListener.onMotionFinished = function() {
        mc_01.loadMovie(path1+filename[k], 0);
        mc_01.onLoad = slideshow();
    };
    fadein = new mx.transitions.Tween(mc_02, "_alpha", null, this._alpha, 100, 10, false);
    fadeout = new mx.transitions.Tween(mc_01, "_alpha", null, this._alpha, 0, 10, false);
    fadeout.addListener(fadeListener);
}
//
first_image();
stop();

```

–Files–  
[.FLA](http://130public.net/test_area/image_gallery/gallery.fla)  
[.SWF](http://130public.net/test_area/image_gallery/gallery.swf)  
[.HTML](http://130public.net/test_area/image_gallery/gallery.html)
