# Positioning 2 loaded images together in MX

**URL:** https://forum.kirupa.com/t/positioning-2-loaded-images-together-in-mx/190491
**Category:** flash
**Created:** [June 12, 2006, 11:06am UTC](https://forum.kirupa.com/t/positioning-2-loaded-images-together-in-mx/190491 "2006-06-12T11:06:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Flash\_M\_in\_X](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@Flash\_M\_in\_X](https://forum.kirupa.com/u/Flash_M_in_X)
#### Post date: [June 12, 2006, 11:06am UTC](https://forum.kirupa.com/t/positioning-2-loaded-images-together-in-mx/190491/1 "2006-06-12T11:06:31Z")

</div>

I’m having trouble trying to work out how to centre 2 loaded images via XML. I found some code by scotty that will centre one image but of course when I’m loading 2 images, they are both stacked ont top of each other.

I think I know what I need to do but not sure how to transfer that into ActionScript. ie - I want to get the width of picture1 and picture2, put a bit of space in between and then centre them both on the stage.

Here is the code I have for that part (let me know if I need to post any other part of it). Can anyone help me amend what I’ve got to achieve what I need or do I need to do it a different way?

```auto
p = 0;
var cx = picture._x;
var cy = picture._y;
var dx = picture2._x;
var dy = picture2._y;
this.onEnterFrame = function() {
	filesize = picture.getBytesTotal() && picture2.getBytesTotal();
	loaded = picture.getBytesLoaded() && picture2.getBytesLoaded();
	preloader._visible = true;
	if (loaded != filesize) {
		preloader.preload_bar._xscale = 100*loaded/filesize;
	} else {
		preloader._visible = false;
		if (picture._alpha<100) {
			picture._alpha += 10;
		}
		if (picture2._alpha<100) {
			picture2._alpha += 10;
		}
		if (ClientMC.client_txt._alpha<100) {
			ClientMC.client_txt._alpha += 10;
		}
		if (DescMC.desc_txt._alpha<100) {
			DescMC.desc_txt._alpha += 10;
		}
	}
	 picture._x = cx-picture._width/2;
     picture._y = cy-picture._height/2;

	 picture2._x = dx-picture2._width/2;
     picture2._y = dy-picture2._height/2;
	 
};

```

Thanks
