# Elasticity Problems in Player 7

**URL:** <https://forum.kirupa.com/t/elasticity-problems-in-player-7/155730>\
**Category:** flash\
**Created:** [July 19, 2005, 9:56pm UTC](https://forum.kirupa.com/t/elasticity-problems-in-player-7/155730 "2005-07-19T21:56:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![serkios](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/serkios/32/608_2.png) [@serkios](https://forum.kirupa.com/u/serkios)\
**Post date:** [July 19, 2005, 9:56pm UTC](https://forum.kirupa.com/t/elasticity-problems-in-player-7/155730/1 "2005-07-19T21:56:48Z")

</div>

Okay I’m trying to write a prototype function that I constructed off of a tutorial from [bit101.com](http://bit101.com). Its a basic motion script for elasticity. The code when exported in Flash Player 6 works great. Now, when I publish this code in Player 7 everything breaks. I’ve narrowed the problem down to when velX and velY are calculated, it returns NaN. Anyone know why this is and/or have a fix so it will work in both versions?

Here’s my code:

```auto

MovieClip.prototype.bounceTo = function (endX, endY, inertia, k, interval) {
	clearInterval(bounceInterval);
	bounceInterval = setInterval(bounceAction, interval, this, endX, endY, inertia, k);
}
function bounceAction (clip, targX, targY, inertia, k) {	
	accelX = (targX-clip._x)*k
	velX += accelX;
	velX *= inertia;

	accelY = (targY-clip._y)*k;
	velY += accelY;
	velY *= inertia;

	clip._x += velX;
	clip._y += velY;
	//trace(accelX);
	if (Math.abs(accelX) < .005 && Math.abs(accelY) < .005) {
		trace("!ending bounceTo!");
		clearInterval(bounceInterval);
	}
}

```
