# Resize width and height

**URL:** <https://forum.kirupa.com/t/resize-width-and-height/178839>\
**Category:** Uncategorized\
**Created:** [February 14, 2006, 6:03pm UTC](https://forum.kirupa.com/t/resize-width-and-height/178839 "2006-02-14T18:03:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![froesi](https://avatars.discourse-cdn.com/v4/letter/f/b2d939/32.png) [@froesi](https://forum.kirupa.com/u/froesi)\
**Post date:** [February 14, 2006, 6:03pm UTC](https://forum.kirupa.com/t/resize-width-and-height/178839/1 "2006-02-14T18:03:01Z")

</div>

Hi guys,

I have a container, which resize in the width, because i just want to change the width of the container in the gallery.  
But I want to use the same container for other stuff, so that the container should resize in height and width.

Here the code for resizing width.

```php

MovieClip.prototype.resizeMe = function(w, h, id) {
    var speed = 3;
    container._alpha = 0;
    this.onEnterFrame = function() {
        this._width += (w-this._width)/speed;
        this._height += (h-this._height)/speed;
        if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
            this._width = w;
            this._height = h;
            container._x = this._x+spacing/2;
            container._y = this._y-this._height/2+spacing/2;
            info._y = Math.round(this._y+this._height/2+spacing/2);
            container._alpha += 5;
            if (container._alpha>90) {
                container._alpha = 100;
                delete this.onEnterFrame;
            }
        }
    };
};

```

So it takes the pictures and resize the container. The pictures all have the same height.  
Now I want to load a textfield for example:  
I’m calling the container like that : container.resizeMe(309, 278);

So the container should now change the width and (then) the height.  
The point is, that it’ll not start at the same x- and y-point like it did before for changing the picturesize.

Do you have an idea?

cheers  
froesi
