# Make this prototype resize height first then width

**URL:** <https://forum.kirupa.com/t/make-this-prototype-resize-height-first-then-width/227310>\
**Category:** Uncategorized\
**Created:** [May 29, 2007, 10:11am UTC](https://forum.kirupa.com/t/make-this-prototype-resize-height-first-then-width/227310 "2007-05-29T10:11:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duck](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@Duck](https://forum.kirupa.com/u/Duck)\
**Post date:** [May 29, 2007, 10:11am UTC](https://forum.kirupa.com/t/make-this-prototype-resize-height-first-then-width/227310/1 "2007-05-29T10:11:13Z")

</div>

Hi i got a prototype that i wanna adjust so it will first animate the height, then the width…

**Original prototype:**

```auto
MovieClip.prototype.loadPic = function(pic){
    delete enter();
    _root.containerMC._alpha = 0;
    this.loadMovie(pic);
    enter = _root.onEnterFrame = function(){
        var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
        if (t != 0 && Math.round(l/t) == 1){
            var w = containerMC._width + spacing, h = containerMC._height + spacing;
            border.resizeMe(w, h);
            delete this.onEnterFrame;
        }
    }
};
MovieClip.prototype.resizeMe = function(w, h){
    var speed = 9;
    this.onEnterFrame = function(){
        this._height += (h - this._height)/speed;
        this._width += (w - this._width)/speed;
        if( Math.abs(this._width-w)<1){
            this._width = w;
            this._height = h;
            _root.containerMC._x = this._x - this._width/2 + spacing/2;
            _root.containerMC._y = this._y - this._height/2 + spacing/2;
            _root.containerMC._alpha = 100;
            _root.closebtn._y = _root.containerMC._y - 12
            _root.closebtn._x = _root.containerMC._x + _root.containerMC._width - 30
            _root.closebtn._visible = 1;
            delete this.onEnterFrame;
        }
    }
};

```

**Ive tried this:**

```auto
MovieClip.prototype.resizeMe = function(w, h){
    var speed = 9;
    this.onEnterFrame = function(){
        this._height += (h - this._height)/speed;
        ***if (this._height == containerMC._height){
        this._width += (w - this._width)/speed;
        }***
        if( Math.abs(this._height-h)<1){
            this._width = w;
            this._height = h;
            _root.containerMC._x = this._x - this._width/2 + spacing/2;
            _root.containerMC._y = this._y - this._height/2 + spacing/2;
            _root.containerMC._alpha = 100;
            _root.closebtn._y = _root.containerMC._y - 12
            _root.closebtn._x = _root.containerMC._x + _root.containerMC._width - 30
            _root.closebtn._visible = 1;
            delete this.onEnterFrame;
        }
    }
};

```

This doesnt animate it tho, im still pretty new to AS so i probably wont get it to work on my own. :-/

Id really appreciate any help. :beam:

Thanks

- Duck.
