Help with bounce physics and hit test

This code does what I want except for all the vibrating once the mc has stopped bouncing. I guess it’s still bouncing. :ponder: I threw in a ‘delete.onEnterFrame’ if _y==floor, but that doesn’t give me the desired results. I want it to bounce for a bit then come to a rest with no vibration.

Can anyone help with this? I’d upload a basic .fla, but I’m restricted from uploads at work. All you need to do is create a 100x300 .fla, make a mc with the instance name of box_mc, place it at 10y, 25x and paste the code into the actions panel.

ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]floor[/COLOR] = [COLOR=#000080]250[/COLOR];

bounce = [COLOR=#000080]0[/COLOR].[COLOR=#000080]2[/COLOR];
[COLOR=#0000FF]MovieClip[/COLOR].[COLOR=#0000FF]prototype[/COLOR].[COLOR=#000080]moveWithGravity[/COLOR] = [COLOR=#000000]function[/COLOR][COLOR=#000000]([/COLOR]vel:[COLOR=#0000FF]Number[/COLOR], gravity:[COLOR=#0000FF]Number[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]dy[/COLOR] = vel+gravity;
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]_y[/COLOR] += [COLOR=#0000FF]this[/COLOR].[COLOR=#000080]dy[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]dy[/COLOR] += gravity;
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]_y[/COLOR] = [COLOR=#0000FF]floor[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]dy[/COLOR] = -bounce;
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]
/if (this._y == floor) {
delete this.onEnterFrame;
}
/*[/COLOR]
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR];
box_mc.[COLOR=#0000FF]onPress[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]moveWithGravity[/COLOR][COLOR=#000000]([/COLOR]-[COLOR=#000080]5[/COLOR], [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]