# Begginner programmer

**URL:** <https://forum.kirupa.com/t/begginner-programmer/35428>\
**Category:** flash\
**Created:** [November 13, 2003, 10:55pm UTC](https://forum.kirupa.com/t/begginner-programmer/35428 "2003-11-13T22:55:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeka](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zeka](https://forum.kirupa.com/u/zeka)\
**Post date:** [November 13, 2003, 10:55pm UTC](https://forum.kirupa.com/t/begginner-programmer/35428/1 "2003-11-13T22:55:55Z")

</div>

Hey! I’ve been writing my first piece of actionscript (without copying and pasting it or typeing it exactly the same as somewhere else) but there is a problem. I have a movieclip called man with the instance name of man. now inside the movieclip ive got two layers: LAYER 1 and CONTROL. on LAYER 1 there are 4 keyframes (showing the guy kicking) and on frame 1 and 4 of the layer CONTROL there are stop actions to prevent the guy from continuously kicking. i want him to kick when the right key is pressed so this is the code i put on the first frame of my movie:

stop();

onClipEvent (load) {}

if (Key.isDown(Key.RIGHT)) {}  
\_root “man” (gotoAndPlay) (2);

I havent got the slightest idea why this isnt working because of my knowledge of actionscript (basically none).

could someone please tell me wut is wrong?

Thanks a heap! 🙂 🙂 🙂

---

<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:** [November 13, 2003, 11:06pm UTC](https://forum.kirupa.com/t/begginner-programmer/35428/2 "2003-11-13T23:06:09Z")

</div>

Your sintax is wrong, thats why its not working. Use something like this:

```auto
onClipEvent (keyDown) {
	if (Key.isDown(Key.RIGHT)) {
		gotoAndPlay(2);
	}
}

```

---

<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:** [November 13, 2003, 11:11pm UTC](https://forum.kirupa.com/t/begginner-programmer/35428/3 "2003-11-13T23:11:25Z")

</div>

thanks. it works!! but how would i make him move right by 10 pixels if say… D was pressed down. it would be something x+ 10 or something, wouldn’t it?

---

<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:** [November 13, 2003, 11:15pm UTC](https://forum.kirupa.com/t/begginner-programmer/35428/4 "2003-11-13T23:15:31Z")

</div>

```auto
onClipEvent (keyDown) {
	if (Key.isDown(Key.RIGHT)) {
		gotoAndPlay(2);
	} else if (Key.isDown(68)) {
		_x += 10;
	}
}

```
