# Centralising external .jpg file in a emptyMovieClip

**URL:** <https://forum.kirupa.com/t/centralising-external-jpg-file-in-a-emptymovieclip/118316>\
**Category:** Uncategorized\
**Created:** [August 4, 2004, 2:07pm UTC](https://forum.kirupa.com/t/centralising-external-jpg-file-in-a-emptymovieclip/118316 "2004-08-04T14:07:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![icube](https://avatars.discourse-cdn.com/v4/letter/i/f19dbf/32.png) [@icube](https://forum.kirupa.com/u/icube)\
**Post date:** [August 4, 2004, 2:07pm UTC](https://forum.kirupa.com/t/centralising-external-jpg-file-in-a-emptymovieclip/118316/1 "2004-08-04T14:07:43Z")

</div>

anyone noe how to do this…?

say i got this empty movie clip which loads .jpg files… the dimensions of the empty movie clip is 800 by 550…

by default, the top most left of the external .jpg image will load onto the 0 by 0 point of the movie clip… but i want it to display the .jpg image in the center of the empty movie clip…

my guess is i have to get the dimensions of the external .jpg and then calculate from there… anyone has done this and would kind enough to share his/her code…?

advice and suggestions needed… TIA… :s:

---

<div class="post-metadata">

**Author:** ![e\_s\_x\_s](https://avatars.discourse-cdn.com/v4/letter/e/f9ae1b/32.png) [@e\_s\_x\_s](https://forum.kirupa.com/u/e_s_x_s)\
**Post date:** [August 4, 2004, 5:28pm UTC](https://forum.kirupa.com/t/centralising-external-jpg-file-in-a-emptymovieclip/118316/2 "2004-08-04T17:28:17Z")

</div>

try to change your movieclip’s center position to top left corner.  
u can do it when you creating new movieclip,  
there is an option something like “Register Positon”… choose the top-left corner.

PS. this can be made with AS but i think try to do this first.

---

<div class="post-metadata">

**Author:** ![paradox244](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@paradox244](https://forum.kirupa.com/u/paradox244)\
**Post date:** [August 5, 2004, 2:13am UTC](https://forum.kirupa.com/t/centralising-external-jpg-file-in-a-emptymovieclip/118316/3 "2004-08-05T02:13:03Z")

</div>

try this:  
myJpgHolder.\_x = (800 - myJpgHolder.\_width)/2;  
myJpgHolder.\_y = (550 - myJpgHolder.\_height)/2;

that will center it for you, all you have to do is make sure the picture is loaded before you try to do that otherwise it won’t work, you could do this:

if(myJpgHolder.\_width){  
myJpgHolder.\_x = (800 - myJpgHolder.\_width)/2;  
myJpgHolder.\_y = (550 - myJpgHolder.\_height)/2;  
}

and that will work as long as the width is something other than 0 or undefined, in other words the picture is loaded.
