Exporting Old AS2 Code to Flash Player 7/8 - Breaks My Code - Please Help!

I’ve got this old code from back in '05 that I wanted to use in something but when I export it for anything higher than flash player 6, it stops working. Nothing happens. Can someone take a look and let me know what I’m missing here please?

stageWidth = 800;
stageHeight = 600;
bouncefactor = .7;
speedfactor = 8;
MovieClip.prototype.expand = function(wmodifier, hmodifier,p,s) {
    var destx = (stageWidth-wmodifier)/p;
    var desty = (stageHeight-hmodifier)/2;
    var destwidth = wmodifier;
    var destheight = hmodifier;
    var poswidth, posheight, posx, posy, velwidth, velheight, velx, vely;
    this.onEnterFrame = function() {
        poswidth = this._width;
        velwidth = velwidth*bouncefactor+(destwidth-poswidth)/speedfactor;
        this._width += Math.round(velwidth);
        posheight = this._height;
        velheight = velheight*bouncefactor+(destheight-posheight)/speedfactor;
        this._height += Math.round(velheight);
        posx = this._x;
        velx = velx*bouncefactor+(destx-posx)/speedfactor;
        this._x += Math.round(velx);
        posy = this._y;
        vely = vely*bouncefactor+(desty-posy)/speedfactor;
        this._y += Math.round(vely);
        this._parent["shadow"+s]._width = (this._width+20);
        this._parent["shadow"+s]._x = (this._x-10);
        this._parent["shadow"+s]._height = (this._height+20);
        this._parent["shadow"+s]._y = (this._y-10);
        if (Math.abs(wmodifier-this._width)<1 && Math.abs(hmodifier-this._height)<1) {
            this._x = destx;
            thi._y = desty;
            this._width = wmodifier;
            this._height = hmodifier;
            delete this.onEnterFrame;
        }
    };
};