# Image problems in photo gallery

**URL:** <https://forum.kirupa.com/t/image-problems-in-photo-gallery/98217>\
**Category:** Uncategorized\
**Created:** [January 4, 2004, 8:33pm UTC](https://forum.kirupa.com/t/image-problems-in-photo-gallery/98217 "2004-01-04T20:33:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arsestar](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@arsestar](https://forum.kirupa.com/u/arsestar)\
**Post date:** [January 4, 2004, 8:33pm UTC](https://forum.kirupa.com/t/image-problems-in-photo-gallery/98217/1 "2004-01-04T20:33:02Z")

</div>

I’ve altered the code from the photo gallery tutorial a little to fit with the right paths and syntax, but the only problem is once the image is loaded, it shifts 1 pixel out of proportion.  
I did the Transform on the movie clip to constrain the proportions to 100% by 100%, but it still shifts every time the image loads.

Note: The image looks fine as it is fading in and fading out. Only when it shows after the fade does it shift. Here’s a copy of the code and thanks for your help.

this.pathToPics = “sa picnic/”;  
this.pArray = [“picnic1.jpg”, “picnic2.jpg”, “picnic3.jpg”, “picnic4.jpg”, “picnic5.jpg”, “picnic6.jpg”, “picnic7.jpg”, “picnic8.jpg”, “picnic9.jpg”, “picnic10.jpg”, “picnic11.jpg”, “picnic12.jpg”, “picnic13.jpg”, “picnic14.jpg”, “picnic15.jpg”, “picnic16.jpg”, “picnic17.jpg”, “picnic18.jpg”, “picnic19.jpg”, “picnic20.jpg”, “picnic21.jpg”, “picnic22.jpg”, “picnic23.jpg”, “picnic24.jpg”, “picnic25.jpg”];  
this.fadeSpeed = 20;  
this.pIndex = 0;  
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 = this.photo;  
p.\_alpha = 0;  
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);  
this.onEnterFrame = loadMeter;  
};  
MovieClip.prototype.loadMeter = function() {  
var l, t;  
l = this.photo.getBytesLoaded();  
t = this.photo.getBytesTotal();  
if (t\>0) {  
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;  
}  
};  
this.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
this.changePhoto(-1);  
} else if (Key.getCode() == Key.RIGHT) {  
this.changePhoto(1);  
}  
};  
Key.addListener(this);
