# Dynamic Auto-run photogallery

**URL:** <https://forum.kirupa.com/t/dynamic-auto-run-photogallery/114455>\
**Category:** Uncategorized\
**Created:** [June 28, 2004, 7:36pm UTC](https://forum.kirupa.com/t/dynamic-auto-run-photogallery/114455 "2004-06-28T19:36:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nycbrian](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@nycbrian](https://forum.kirupa.com/u/nycbrian)\
**Post date:** [June 28, 2004, 7:36pm UTC](https://forum.kirupa.com/t/dynamic-auto-run-photogallery/114455/1 "2004-06-28T19:36:48Z")

</div>

Hey all,

I am trying to make a photogallery that is dynamic instead of throwing the pictures in a movie and tweening effect inbetween them. I know, why take the easy route.

I have something really wierd going on, maybe you can help. What basically I want to happen is that when the movie loads the first image is displayed for 4 seconds then fades out as the next image is fading in. I have 11 pictures that are in a folder called “weddings”. The pictures are all named “weddings0.jpg”, “weddings1.jpg”, “weddings2.jpg”,… “weddings10.jpg”. Here is the code for this part, I have tested and it works:

```auto
 totalImages = 11;
k=0; 
var aWedding = new Array;
//The for statement creates new movieClips with the images loaded and stored within
//stores the movieclips in an array. 
//It sores them in backwards order to create the layer order I want 
//with array position 0 movieclip at the top layer to array position 10 at the bottom
//sets all but the first image to alpha = 0 
for(i=totalImages-1; i >= 0; i--){
this.createEmptyMovieClip("weddings"+i, this.getNextHighestDepth());
this["weddings"+i].loadMovie("weddings/weddings"+i+".jpg", this.getNextHighestDepth()); 
aWedding* = this["weddings"+i];
if(i != 0){
aWedding*._alpha = 0;
}
}

```

At this point I have loaded all the images into movieclips and stored their references in an array. I have also gotten them all alpha of 0 except the first image, weddings0, which I want to display first.

My function to make the images scroll through doesn’t work. If I trace what the alpha is as it scrolls though I get wierd numbers like 93.3233432 or 32.323223 which doesn’t make sense to me because I am increasing or decreasing the alpha by += 2 or -= 2. I don’t know where the functions come. anyway, here is the code, or what I have I should say, btw I have the code linked to a button right now to test if it works, I would like it to run automatically on load:

```auto
 
butt.onRelease = function(){
trace(k + " k");
tempInt = setInterval(fadeInOut, 10, aWedding[k], aWedding[k+1]);
 
}
function fadeInOut(mcPic1, mcPic2){
mcPic1._alpha -= 2;
mcPic2._alpha += 2;
if(mcPic1._alpha <= 0 && mcPic1 >= 100){
clearInterval(tempInt);
k++
 
}
updateAfterEvent();
}

```

Please help. My brain is getting fried from trying to troubleshoot this. I am using flash mx 2004 btw, but I want the script to be compatible with version 6 of the plugin.

-Brian
