# How to centre align loaded images

**URL:** https://forum.kirupa.com/t/how-to-centre-align-loaded-images/217407
**Category:** flash
**Created:** [February 26, 2007, 7:00pm UTC](https://forum.kirupa.com/t/how-to-centre-align-loaded-images/217407 "2007-02-26T19:00:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![maninderv](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@maninderv](https://forum.kirupa.com/u/maninderv)
#### Post date: [February 26, 2007, 7:00pm UTC](https://forum.kirupa.com/t/how-to-centre-align-loaded-images/217407/1 "2007-02-26T19:00:50Z")

</div>

Hi Everyone,

I am very very new to flash and as my first project, I am building a swf that is supposed to load external images through the xml file into my own swf.

For simplicity, lets assume that I wanted to load an image into my swf file.

I create an empty movie clip (ctrl+f8) then drag it onto the stage and give it an instance name of parent\_mc. Then press f9 to go to the actions panel and type the following -

\_root.parent\_mc.createEmptyMovieClip(“child\_mc”, 99);  
\_root.parent\_mc.child\_mc.\_lockroot = true;  
\_root.parent\_mc.loadMovie(“[http://localhost/img/1\_medium.jpg](http://localhost/img/1_medium.jpg)”, \_root.parent\_mc.child\_mc);

\_root.parent\_mc.\_xscale = 50;  
\_root.parent\_mc.\_yscale = 50;

The image shows up fine.

Now my issues -

1. I want parent\_mc to be 300 x 300. I couldnt get it to work by giving it \_width & \_height. So, I did a hit & trial with \_xscale and \_yscale that I still dont understand. Why can’t I give parent\_mc a height and width?

2. Now, all images that are big load fine, but if there is some image that is 200 x 200, I want it to be centred. How do I handle that?

Any help would be appreciated.

Thanks,  
Mandy
