# Applying acceleration movieclip

**URL:** <https://forum.kirupa.com/t/applying-acceleration-movieclip/276775>\
**Category:** Uncategorized\
**Created:** [December 3, 2008, 3:49pm UTC](https://forum.kirupa.com/t/applying-acceleration-movieclip/276775 "2008-12-03T15:49:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grebs](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@grebs](https://forum.kirupa.com/u/grebs)\
**Post date:** [December 3, 2008, 3:49pm UTC](https://forum.kirupa.com/t/applying-acceleration-movieclip/276775/1 "2008-12-03T15:49:40Z")

</div>

I am trying to add acceleration to a movieclip called Ground. I have written this code

package {  
import flash.display.Stage;  
import flash.display.Sprite;  
import flash.ui._;  
import flash.events._;

public class Ground extends Sprite{  
private var xVel:Number = 0;  
private var xAcc:Number = -0.25;

```
public function Accelerate()
{
    init();
}

private function init():void
{
    stage.addEventListener(KeyboardEvent.KEY_DOWN, go);
}

private function go(event:KeyboardEvent):void
{
    if(event.keyCode == Keyboard.UP){
        xVel += xAcc;
        }
    }
}

```

}

The movieclip loads fine and i get no errors, but when the up button is pressed nothing happens. Can anyone help?
