# AS 2 Centering external JPEG in emptymovieclip

**URL:** <https://forum.kirupa.com/t/as-2-centering-external-jpeg-in-emptymovieclip/271792>\
**Category:** flash\
**Created:** [September 28, 2008, 6:17pm UTC](https://forum.kirupa.com/t/as-2-centering-external-jpeg-in-emptymovieclip/271792 "2008-09-28T18:17:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmak](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@mmak](https://forum.kirupa.com/u/mmak)\
**Post date:** [September 28, 2008, 6:17pm UTC](https://forum.kirupa.com/t/as-2-centering-external-jpeg-in-emptymovieclip/271792/1 "2008-09-28T18:17:47Z")

</div>

I’m using this source file to create my photo gallery:  
[http://www.kirupa.com/developer/actionscript/moviecliploader.htm](http://www.kirupa.com/developer/actionscript/moviecliploader.htm)

How would I modify this code to make the external JPEG load in the center of the movie? Any help is appreciated!!

============  
MovieClip.prototype.fadeIn = function() {  
this.onEnterFrame = function() {  
if (this.\_alpha\<100) {  
this.\_alpha += 10;  
} else {  
delete this.onEnterFrame;  
}  
};  
};  
bar.\_visible = false;  
border.\_visible = false;  
var empty = this.createEmptyMovieClip(“container”, “100”);  
empty.\_x = 0;  
empty.\_y = 0;  
my\_mc = new MovieClipLoader();  
preload = new Object();  
my\_mc.addListener(preload);  
preload.onLoadStart = function(targetMC) {  
trace("started loading "+targetMC);  
container.\_alpha = 0;  
bar.\_visible = true;  
border.\_visible = true;  
pText.\_visible = true;  
};  
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {  
bar.\_width = (lBytes/tBytes)\*100;  
pText.text = “% “+Math.round((lBytes/tBytes)\*100);  
};  
preload.onLoadComplete = function(targetMC) {  
container.fadeIn();  
border.\_visible = false;  
bar.\_visible = false;  
dText.\_visible = false;  
trace(targetMC+” finished”);  
};  
//default image  
my\_mc.loadClip(“movieClipLoader/picture1.jpg”, “container”);  
//buttons  
button1.onPress = function() {  
my\_mc.loadClip(“[http://www.kirupa.com/developer/actionscript/animation/picture1.jpg](http://www.kirupa.com/developer/actionscript/animation/picture1.jpg)”, “container”);  
};  
button2.onPress = function() {  
my\_mc.loadClip(“[http://www.kirupa.com/developer/actionscript/animation/picture2.jpg](http://www.kirupa.com/developer/actionscript/animation/picture2.jpg)”, “container”);  
};  
button3.onPress = function() {  
my\_mc.loadClip(“[http://www.kirupa.com/developer/actionscript/animation/picture3.jpg](http://www.kirupa.com/developer/actionscript/animation/picture3.jpg)”, “container”);  
};
