# Maintain image aspect ratio

**URL:** <https://forum.kirupa.com/t/maintain-image-aspect-ratio/270351>\
**Category:** Uncategorized\
**Created:** [September 9, 2008, 3:18am UTC](https://forum.kirupa.com/t/maintain-image-aspect-ratio/270351 "2008-09-09T03:18:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SopaSeco](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@SopaSeco](https://forum.kirupa.com/u/SopaSeco)\
**Post date:** [September 9, 2008, 3:18am UTC](https://forum.kirupa.com/t/maintain-image-aspect-ratio/270351/1 "2008-09-09T03:18:34Z")

</div>

Hi, i try to charge a XML images inside a movieclip, but i need this movie clip maintain the aspect ratio. This movie clip gonna change with the size of the explorer, but when this change my image is going stretch. I used this code doesn’t work but i try:

```auto
stageListener.onResize = function() {
	MC._x = Math.round((Stage.width/2)-(MC._width/2));
	MC._y = 153;
	MC._height = Math.round(Stage.height-200); 
};

Stage.addListener(stageListener);

```

My images have a size of W=900px by H=600px

and sorry for my bad english :beam:
