# Problem loading pics into right position

**URL:** https://forum.kirupa.com/t/problem-loading-pics-into-right-position/97713
**Category:** Uncategorized
**Created:** [December 28, 2003, 4:31am UTC](https://forum.kirupa.com/t/problem-loading-pics-into-right-position/97713 "2003-12-28T04:31:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![onestepaway](https://avatars.discourse-cdn.com/v4/letter/o/e8c25b/32.png) [@onestepaway](https://forum.kirupa.com/u/onestepaway)
#### Post date: [December 28, 2003, 4:31am UTC](https://forum.kirupa.com/t/problem-loading-pics-into-right-position/97713/1 "2003-12-28T04:31:21Z")

</div>

I have posted numerous times learning new things to get my photo gallery working and i’m almost done, but i still have one problem. I have been trying to find out how to load the photos into the center of a movie from the center of the photos. I just got this code which makes the photos load directly into the center of the stage, but i was wondering if there is code to load the movies directly into a certain movie clip. At the bottom is the new code that i just got, and the file is also attached if anyone would like to look at that and help me out. I want to get the photos so that when they load they appear in the center of the cone movie clip.

var absX = Stage.width/2.;  
var absY = Stage.height/2.;  
this.pathToPics = “”;  
this.pArray = [“scarlet1.jpg”, “scarlet2.jpg”, “scarlet3.jpg”];  
this.fadeSpeed = 20;  
this.pIndex = 0;  
//loading en setting x/y for first picture  
loadMovie(this.pathToPics+this.pArray[0], this.photo);  
this.photo.\_x = absX-276;//first picture = 178 width/2  
this.photo.\_y = absY-238;//first picture = 277 height/2  
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 i, l, t;  
l = this.photo.getBytesLoaded();  
t = this.photo.getBytesTotal();  
if (t\>0 && t == l) {  
this.onEnterFrame = fadeIn;  
this.photo.\_x = absX-this.photo.\_width/2;  
this.photo.\_y = absY-this.photo.\_height/2;  
} 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);

Any help would be much appreciated.  
Thanks  
-Ryan.
