Removing onEnterFrame Conditional Not Working Will SetInterval?

Hi all,

I am working on someones as2 file and I noticed that they had an onEnterFrame running non stop in the movie. I don’t use onEnterFrame personally. So I tried to create a conditional to stop it. While the conditional worked its stopped the fluid animation they had used. So I need to figure out some other way to get rid of the onEnterFrame. Anyone have any ideas here? The AS basically resizes a box on stage when certain movies are loaded.


mainborder.physics0 = 0.3;
mainborder.physics1 = 0.35;
mainborder._width = 0;
mainborder._height = 0;
mainborder.xspeed = 0;
mainborder.yspeed = 0;

mainborder.onEnterFrame = function () {
        if (this.bounce == 1) {
            this.xspeed = ((500 - this._width) * this.physics0) + (this.xspeed * this.physics1);
            this.yspeed = ((420 - this._height) * this.physics0) + (this.yspeed * this.physics1);
            this._width = this._width + this.xspeed;
            this._height = this._height + this.yspeed;
            updateAfterEvent();
        }
        if (this.bounce == 2) {
            this.xspeed = ((-this._width) * this.physics0) + (this.xspeed * this.physics1);
            this.yspeed = ((-this._height) * this.physics0) + (this.yspeed * this.physics1);
            this._width = this._width + this.xspeed;
            this._height = this._height + this.yspeed;
            updateAfterEvent();
        }
    };

I tried what I thought was most logical. Once a certain width and height are met delete the onEnterFrame but this completely ruined the animation.


mainborder.onEnterFrame = function() {
    trace("onEnterFrame");
    
    if (this.bounce == 1) {
        trace("Condition1");
        
        this.xspeed = (500-this._width)*this.physics0+this.xspeed*this.physics1;
        this.yspeed = (420-this._height)*this.physics0+this.yspeed*this.physics1;
        this._width = this._width+this.xspeed;
        this._height = this._height+this.yspeed;
        updateAfterEvent();
        
        //adding condition to delete onEnterFrame since it was running none stop
        if ((this._width=500) && (this._height=420)) {
            delete this.onEnterFrame;
        }
    }