# Scale images proportionally

**URL:** https://forum.kirupa.com/t/scale-images-proportionally/295439
**Category:** flash
**Created:** [August 30, 2009, 10:33am UTC](https://forum.kirupa.com/t/scale-images-proportionally/295439 "2009-08-30T10:33:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ttmt](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@ttmt](https://forum.kirupa.com/u/ttmt)
#### Post date: [August 30, 2009, 10:33am UTC](https://forum.kirupa.com/t/scale-images-proportionally/295439/1 "2009-08-30T10:33:38Z")

</div>

Scale images proportionally

Hi all

I have a simple test site to test scaling images proportionally.

[http://www.ttmt.org.uk/imgScale/](http://www.ttmt.org.uk/imgScale/)

```auto

stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;

var hh:Number=80;
var fh:Number=160;
var hfh:Number=240;

stage.addEventListener(Event.RESIZE, stage_resizeHandler);

function stage_resizeHandler(evt:Event):void {
	var sw:Number=stage.stageWidth;
	var sh:Number=stage.stageHeight;
	header_mc.width=body_mc.width=footer_mc.width=sw;
	body_mc.height=sh-hfh;
	footer_mc.y=sh-fh;
	//
	var w:Number=body_mc.img_mc.width;
	var h:Number=body_mc.img_mc.height;
	var r:Number=Math.round(w/h);
	//
	body_mc.img_mc.width = h*r
}

```

The site is full browser with 3 MovieClips - header\_mc, body\_mc and footer\_mc.

header\_mc is the strip across the top. body\_mc is the middle section, which contains a image that is a MC, img\_mc. footer\_mc is the bottom strip.

When the browser resizes, header\_mc and footer\_mc stay the same height, but the height of body\_mc will change and footer\_mc sticks to it’s bottom.

When the window resizes I want the image to resize proportionally - that’s where I’m stuck

How can I resize the image to keep it’s proportion.
