# Next picture doesn't appear

**URL:** https://forum.kirupa.com/t/next-picture-doesnt-appear/182588
**Category:** flash
**Created:** [March 19, 2006, 8:47pm UTC](https://forum.kirupa.com/t/next-picture-doesnt-appear/182588 "2006-03-19T20:47:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fr0gg3r](https://avatars.discourse-cdn.com/v4/letter/f/cdc98d/32.png) [@fr0gg3r](https://forum.kirupa.com/u/fr0gg3r)
#### Post date: [March 19, 2006, 8:47pm UTC](https://forum.kirupa.com/t/next-picture-doesnt-appear/182588/1 "2006-03-19T20:47:19Z")

</div>

Hello, I (tried) to modify the actionscript of the tutorial “create a photo gallery”. But I still have a little problem:  
the first picture is shown but after an interval of “20” the picture should change (fade) into the next one. This doesn’t happen. Can someone please check my script, thank you.

// variables ------------------------------------------  
\_root.cont.foto.photo.pathToPics = “images/thegirl/”;  
\_root.cont.foto.photo.pArray = [“1.jpg”, “2.jpg”, “3.jpg”, “4.jpg”, “5.jpg”, “6.jpg”];  
\_root.cont.foto.photo.fadeSpeed = 20;  
\_root.cont.foto.photo.pIndex = 1;

// MovieClip methods ----------------------------------  
loadMovie(\_root.cont.foto.photo.pathToPics+\_root.cont.foto.photo.pArray[0], \_root.cont.foto.photo);  
MovieClip.prototype.changePhoto = function(d) {  
// make sure pIndex falls within pArray.length  
\_root.cont.foto.photo.pIndex = (\_root.cont.foto.photo.pIndex+d)%\_root.cont.foto.photo.pArray.length;  
if (\_root.cont.foto.photo.pIndex\<0) {  
\_root.cont.foto.photo.pIndex += \_root.cont.foto.photo.pArray.length;  
}  
\_root.cont.foto.photo.onEnterFrame = fadeOut;  
};  
MovieClip.prototype.fadeOut = function() {  
if (_root.cont.foto.photo_.alpha\>\_root.cont.foto.photo.fadeSpeed) {  
\_root.cont.foto.photo.\_alpha -= \_root.cont.foto.photo.fadeSpeed;  
} else {  
\_root.cont.foto.photo.loadPhoto();  
}  
};  
MovieClip.prototype.loadPhoto = function() {  
// specify the movieclip to load images into  
var p = \_root.cont.foto.photo;  
p.\_alpha = 0;  
p.loadMovie(\_root.cont.foto.photo.pathToPics+\_root.cont.foto.photo.pArray[\_root.cont.foto.photo.pIndex]);  
\_root.cont.foto.photo.onEnterFrame = loadMeter;  
};  
MovieClip.prototype.loadMeter = function() {  
var i, l, t;  
l = \_root.cont.foto.photo.getBytesLoaded();  
t = \_root.cont.foto.photo.getBytesTotal();  
if (t\>0 && t == l) {  
\_root.cont.foto.photo.onEnterFrame = fadeIn;  
} else {  
trace(l/t);  
}  
};  
MovieClip.prototype.fadeIn = function() {  
if (\_root.cont.foto.photo.\_alpha\<100-\_root.cont.foto.photo.fadeSpeed) {  
\_root.cont.foto.photo.\_alpha += \_root.cont.foto.photo.fadeSpeed;  
} else {  
\_root.cont.foto.photo.\_alpha = 100;  
\_root.cont.foto.photo.onEnterFrame = null;  
}  
};

// Actions -----------------------------------------  
\_root.cont.foto.photo.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
\_root.cont.foto.photo.changePhoto(-1);  
} else if (Key.getCode() == Key.RIGHT) {  
\_root.cont.foto.photo.changePhoto(1);  
}  
};  
Key.addListener(\_root.cont.foto.photo);
