# Actionscript problem

**URL:** <https://forum.kirupa.com/t/actionscript-problem/205005>\
**Category:** Uncategorized\
**Created:** [October 25, 2006, 10:26am UTC](https://forum.kirupa.com/t/actionscript-problem/205005 "2006-10-25T10:26:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nico](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@nico](https://forum.kirupa.com/u/nico)\
**Post date:** [October 25, 2006, 10:26am UTC](https://forum.kirupa.com/t/actionscript-problem/205005/1 "2006-10-25T10:26:52Z")

</div>

im having problem with my script. ball.onEnterFrame = function(){ var speed:Number = 5; if(Key.isdown(Key.RIGHT)){ ball.gotoAndPlay(“animate”); ball.\_x+=speed; } } ball.onKeyUp = function(){ ball.gotoAndStop(“idle”); when i release the right dir key, still, it is animating.

---

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [October 25, 2006, 1:02pm UTC](https://forum.kirupa.com/t/actionscript-problem/205005/2 "2006-10-25T13:02:42Z")

</div>

```auto
ball.onEnterFrame = function ()
{ 
    var speed:Number = 5; 
    if ( Key.isdown ( Key.RIGHT ) ) {
        ball.gotoAndPlay ( "animate" );
        ball._x += speed;
    }
};

ball.onKeyUp = function()
{
    ball.gotoAndStop ( "idle" );
};

```

Works fine here…
