Begginner programmer

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! :slight_smile: :slight_smile: :slight_smile:

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

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

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?

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