# Help!

**URL:** <https://forum.kirupa.com/t/help/325755>\
**Category:** Uncategorized\
**Created:** [November 3, 2011, 12:26am UTC](https://forum.kirupa.com/t/help/325755 "2011-11-03T00:26:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raphaelle](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@raphaelle](https://forum.kirupa.com/u/raphaelle)\
**Post date:** [November 3, 2011, 12:26am UTC](https://forum.kirupa.com/t/help/325755/1 "2011-11-03T00:26:05Z")

</div>

package {

```
// --------------------------------------------------------------------------------------
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;

// Game class (MovieClip extension)
// --------------------------------------------------------------------------------------
public class Game extends MovieClip {
	
	// game properties
	

var hero:MovieClip;
var keyLeftPressed:Boolean = false;	
var keyRightPressed:Boolean = false;
var keyUpPressed:Boolean = false;
var keyAPressed:Boolean = false;
var keySPressed:Boolean = false;

public function Game():void 

	{
		
		
		addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
		addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, false, 0, true);
		addEventListener(KeyboardEvent.KEY_UP, keyUpHandler, false, 0, true);
	}

private function init():void
	{
		hero = new MovieClip;
		hero.onGround;
		hero.gotoAndStop('idle');
	}
	
	private function enterFrameHandler():void
	{
		if (keyLeftPressed) 
		{
			hero.gotoAndStop('walking');
			hero.x =+5;
			
		}
		if (keyRightPressed) 
		{
			hero.gotoAndStop('walking');
			hero.x =-5;
			
		}
		
	}
	
	private function keyDownHandler(event:KeyboardEvent):void
	{
		switch(event.keyCode) 
		{
			case Keyboard.LEFT:
				keyLeftPressed = true;
			break;
			case Keyboard.RIGHT:
				keyRightPressed = true;
			break;
			
		}
	}
	
	private function keyUpHandler(event:KeyboardEvent):void
	{
		switch(event.keyCode)
		{
			case Keyboard.LEFT:
				keyLeftPressed = false;
			break;
			case Keyboard.RIGHT:
				keyRightPressed = false;
			break;
		}
	}

}

```

}

it has no error but i cant move my character, it must stop at ‘idle’  
i tried to put hero.gotoAndStop(‘idle’); but i guess that it doesnt read the keyframes of hero. what should i do ?? tnx in advance !
