# Onkeypress , when you hold any key down it keeps play only 1 frame instead of all of

**URL:** https://forum.kirupa.com/t/onkeypress-when-you-hold-any-key-down-it-keeps-play-only-1-frame-instead-of-all-of/57166
**Category:** Uncategorized
**Created:** [July 10, 2004, 11:59pm UTC](https://forum.kirupa.com/t/onkeypress-when-you-hold-any-key-down-it-keeps-play-only-1-frame-instead-of-all-of/57166 "2004-07-10T23:59:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mdjstudios](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mdjstudios](https://forum.kirupa.com/u/mdjstudios)
#### Post date: [July 10, 2004, 11:59pm UTC](https://forum.kirupa.com/t/onkeypress-when-you-hold-any-key-down-it-keeps-play-only-1-frame-instead-of-all-of/57166/1 "2004-07-10T23:59:48Z")

</div>

ok, i have 1 mc, a stick figure. when i press right arrow key, it is constantly frozen at frame 21 because it keeps play 21 because i am holding down the right arrow key… u understand? take a look at my action script if you dont follow…

```auto
onClipEvent(enterFrame) {
	if(key.isDown(key.RIGHT)) {
		this._x +=5;
		_root.stick.gotoAndPlay(21);
	}
}
onClipEvent(enterFrame) {
	if(!Key.isDown(key.RIGHT) && (_root.stick.ru==1)) {
		_root.stick.gotoAndPlay(42);
	}
}
onClipEvent(enterFrame) {
	 if(_root.stick.ru==2) {
		_root.stick.gotoAndPlay(2);
	}
}

```

please help im trying to create a game…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2004, 12:07am UTC](https://forum.kirupa.com/t/onkeypress-when-you-hold-any-key-down-it-keeps-play-only-1-frame-instead-of-all-of/57166/2 "2004-07-11T00:07:34Z")

</div>

if (\_root.stick.\_currentframe == 20)  
[INDENT]\_root.stick.gotoAndPlay(21);[/INDENT]

look at that, you should see the main concept of it.
