# \[F8\] AS Easing Function

**URL:** <https://forum.kirupa.com/t/f8-as-easing-function/206146>\
**Category:** flash\
**Created:** [November 5, 2006, 10:30pm UTC](https://forum.kirupa.com/t/f8-as-easing-function/206146 "2006-11-05T22:30:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Twin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/the_twin/32/2935_2.png) [@The\_Twin](https://forum.kirupa.com/u/The_Twin)\
**Post date:** [November 5, 2006, 10:30pm UTC](https://forum.kirupa.com/t/f8-as-easing-function/206146/1 "2006-11-05T22:30:07Z")

</div>

Hello!  
Quick question for you guys. I’m working on this “game” and I currently have a ball that increases in speed as you hold down the arrow key. What I am now trying to accomplish is I want the ball to ease to a stop when the user let’s go of the keyboard key (onKeyUp). Here’s the [File.](http://www.geocities.com/flash4storage/experiment.swf)\<—Link

Here is my code so far:

```auto

var speed = 10;

ball_mc.onEnterFrame = function (){
    if(Key.isDown(Key.RIGHT)){
                this._x += speed += 1;  
    }
    if(Key.isDown(Key.UP)){
            this._y -= speed += 1;
    }
    if(Key.isDown(Key.LEFT)){
            this._x -= speed += 1;
            
    }
    if(Key.isDown(Key.DOWN)){
            this._y += speed += 1;  
    }
    if(speed >= 45){
        speed = 45;
    }
}

```

So once you let go of the Keyboard Key I want the ball to slow down to a stop. Thanks for your help!  
-Loren 😏
