# Photo gallery using XML and Flash question...align center?

**URL:** <https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-question-align-center/159420>\
**Category:** Uncategorized\
**Created:** [August 17, 2005, 12:41pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-question-align-center/159420 "2005-08-17T12:41:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan\_tvp](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@ryan\_tvp](https://forum.kirupa.com/u/ryan_tvp)\
**Post date:** [August 17, 2005, 12:41pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-question-align-center/159420/1 "2005-08-17T12:41:15Z")

</div>

Hi, I have a question about the [tutorial](http://../developer/mx2004/xml_flash_photogallery.htm)for creating a gallery that lets you import images using xml. The images load aligned left which isn’t all that good looking for different sized images, I was wondering if there is a way to align the images center when they load? I have to admit my knowledge of flash and actionscript is minimal at best.

I’ve been searching through the forums and have only found [one post of use](http://www.kirupa.com/forum/showthread.php?t=76077&highlight=gallery+XML+centered), it contains this…

> [@txfrog1999](#):
>
> you need to determine the width of the image being loaded (I usually add this information to my XML file along with the height of the image) and then use AS to move the mc loading the image along the \_x axis to center within the container:
> 
> ```auto
> 
> if (img_w[p]<250) {
> x_pos = ((250-img_w[p])/2)+10;
> picture._x = x_pos;
> } else {
> picture._x = 10;
> }
>  
> 
> ```

however I have no idea where in the tutorial AS to put this and not 100% sure where to put the image dimentions in the xml (just new to xml), would a guess at \<image width=“356”\>…\</image\> be right for a 356px image?

Any help would be \*greatly \*appreciated.  
Thanks.
