# Scaling help

**URL:** <https://forum.kirupa.com/t/scaling-help/198016>\
**Category:** flash\
**Created:** [August 21, 2006, 7:46pm UTC](https://forum.kirupa.com/t/scaling-help/198016 "2006-08-21T19:46:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [August 21, 2006, 7:46pm UTC](https://forum.kirupa.com/t/scaling-help/198016/1 "2006-08-21T19:46:53Z")

</div>

Ok so for a while now I had this tiny chunk of code that would resize and image and scale it proportionatly. However I just realized there is an issue and I’m having some trouble fixing it - which should be a joke to fix but I can’t.

```auto

if (_root.base_back.portrait_placeholder._width>99.7) {
    _root.base_back.portrait_placeholder._width = 99.7;
    _root.base_back.portrait_placeholder._yscale = _root.base_back.portrait_placeholder._xscale;
} else {
    _root.base_back.portrait_placeholder._height = 133;
    _root.base_back.portrait_placeholder._yscale = _root.base_back.portrait_placeholder._xscale;
}
if (_root.base_back.portrait_placeholder._height>133) {
    _root.base_back.portrait_placeholder._height = 133;
    _root.base_back.portrait_placeholder._xscale = _root.base_back.portrait_placeholder._yscale;
} else {
    _root.base_back.portrait_placeholder._height = 133;
    _root.base_back.portrait_placeholder._xscale = _root.base_back.portrait_placeholder._yscale;
}

```

The problem is that the width can never be greater then 99.7 and the height can never be greater then 133 - even after it’s scaled.

This code obviously is poorly written and does not handle that.

Any ideas how to make this work?
