# Resize constrain

**URL:** <https://forum.kirupa.com/t/resize-constrain/312102>\
**Category:** Uncategorized\
**Created:** [July 25, 2010, 8:18pm UTC](https://forum.kirupa.com/t/resize-constrain/312102 "2010-07-25T20:18:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeo1313](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mikeo1313](https://forum.kirupa.com/u/mikeo1313)\
**Post date:** [July 25, 2010, 8:18pm UTC](https://forum.kirupa.com/t/resize-constrain/312102/1 "2010-07-25T20:18:25Z")

</div>

Heres my code

//from circlecube blog  
function resizeMe(mj:MovieClip, maxW:Number, maxH:Number=0, constrainProportions:Boolean=true):void  
{  
maxH = maxH == 0 ? maxW : maxH;  
mj.width = maxW;  
mj.height = maxH;  
if (constrainProportions) {  
mj.scaleX \< mj.scaleY ? mj.scaleY = mj.scaleX : mj.scaleX = mj.scaleY;  
}  
}

function loaderComplete(myEvent:Event)  
{  
var loader = new Loader();  
themovie.addChild(loader);  
loader.load(new URLRequest(“2kro.jpg”));  
}

this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);  
resizeMe(themovie, 100, 300);

* * *

Simple enough. But no picture loads unless I comment out the resizeme. An example of what I’m tring to achieve is putting a picture (i.e. 2kro.jpg) inside the center of a tv and a cellular phone pic (they both have different size and are on the same stage). I plan on doing this dynamically and got all the querystring-javascript-flashvar and html working and out of the way.

But I’m stuck with the simple resizing I can’t find a reason why this resizeme function isn’t working.
