# Slide Show

**URL:** <https://forum.kirupa.com/t/slide-show/47179>\
**Category:** Uncategorized\
**Created:** [March 31, 2004, 11:02pm UTC](https://forum.kirupa.com/t/slide-show/47179 "2004-03-31T23:02:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenwhitie](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@jenwhitie](https://forum.kirupa.com/u/jenwhitie)\
**Post date:** [March 31, 2004, 11:02pm UTC](https://forum.kirupa.com/t/slide-show/47179/1 "2004-03-31T23:02:38Z")

</div>

I followed a tutorial and created a slide that loades external .jpgs and fades them in and then transitions nicely to the next. I posted it on the web, and on a fast connection the slides load really nicely and look smooth. On a slow connection, the images never appear because the file doesn’t have time to load before it is told to go on to the next image.

So, is there a way to preload the external .jpg’s?  
The other thing that I was thinking is that I could import all of the .jpg’s into the movie and make mc’s with them. Then I could preload the movie. How would I modify this code to accomidate mc’s?

this.pathToPics = “slides/”;

this.pArray = [“slide\_1.jpg”, “slide\_2.jpg”, “slide\_3.jpg”, “slide\_4.jpg”, “slide\_5.jpg”, “slide\_6.jpg”, “slide\_7.jpg”, “slide\_8.jpg”, “slide\_9.jpg”, “slide\_10.jpg”, “slide\_11.jpg”, “slide\_12.jpg”, “slide\_13.jpg”, “slide\_14.jpg”, “slide\_15.jpg”, “slide\_16.jpg”, “slide\_17.jpg”];  
this.fadeSpeed = 5;  
this.pIndex = 0;

loadMovie(this.pathToPics+this.pArray[0], \_root.photo);  
MovieClip.prototype.changePhoto = function(d) {

this.pIndex = (this.pIndex+d)%this.pArray.length;  
if (this.pIndex\<0) {  
this.pIndex += this.pArray.length;  
}  
this.onEnterFrame = fadeOut;  
};  
MovieClip.prototype.fadeOut = function() {  
if (this.photo.\_alpha\>this.fadeSpeed) {  
this.photo.\_alpha -= this.fadeSpeed;  
} else {  
this.loadPhoto();  
}  
};  
MovieClip.prototype.loadPhoto = function() {  
var p = \_root.photo;  
p.\_alpha = 0;  
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);  
this.onEnterFrame = loadMeter;  
};  
MovieClip.prototype.loadMeter = function() {  
var i, l, t;  
l = this.photo.getBytesLoaded();  
t = this.photo.getBytesTotal();  
if (t\>0 && t == l) {  
this.onEnterFrame = fadeIn;  
} else {  
trace(l/t);  
}  
};  
MovieClip.prototype.fadeIn = function() {  
if (this.photo.\_alpha\<100-this.fadeSpeed) {  
this.photo.\_alpha += this.fadeSpeed;  
} else {  
this.photo.\_alpha = 100;  
this.onEnterFrame = null;  
}  
};  
aChange = function(i) {  
i.changePhoto(1);  
};  
setInterval(aChange, 6000, this);
