# No errrors But cant hear my keyboard

**URL:** <https://forum.kirupa.com/t/no-errrors-but-cant-hear-my-keyboard/316688>\
**Category:** flash\
**Created:** [November 30, 2010, 1:24am UTC](https://forum.kirupa.com/t/no-errrors-but-cant-hear-my-keyboard/316688 "2010-11-30T01:24:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimacy](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rimacy](https://forum.kirupa.com/u/rimacy)\
**Post date:** [November 30, 2010, 1:24am UTC](https://forum.kirupa.com/t/no-errrors-but-cant-hear-my-keyboard/316688/1 "2010-11-30T01:24:07Z")

</div>

My enterFrame works but onKeyDown gets nothin’

can anyOne see it??

```auto
package
{
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.ui.Keyboard;
    import flash.events.KeyboardEvent;
    
    public class PlayScreen extends MovieClip
    {
        var playScreen= new PlayScreenMC();
        var ship= new Ship();
        //var buttonToIntroScreen:Button1=new Button1("introScreen")
// var customEvent:String=""
        
        
        public function PlayScreen():void
        {
            addEventListener(Event.ADDED_TO_STAGE, playGame);
            
            function playGame():void
            {
                playScreen.scaleX=7;
            playScreen.scaleY=7;
            playScreen.x=185;
            playScreen.y=250;
            
            addChild(playScreen);
            playScreen.bumpers_mc.alpha=0;
            ship.scaleX=2;
            ship.scaleY=2;
            ship.x=185;
            ship.y=250;
            addChild(ship);

            stage.addEventListener(Event.ENTER_FRAME,onEnterFrame);
            stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
            stage.addEventListener(KeyboardEvent.KEY_UP,onKeyUp);
            trace("eventListeners");//**[COLOR=Red]<<this Works[/COLOR]**

            }
            
        function onKeyDown(event:KeyboardEvent):void
            {
                trace("keyDownY");//**[COLOR=Red]<<<this does Not work[/COLOR]**
                switch(event.keyCode)
                {
                    case Keyboard.LEFT:
                    trace("left");
                    break;
                    
                    case Keyboard.RIGHT:
                    trace("right");
                    break;
                    case Keyboard.UP:
                    trace("up");
                    break;
                }
            }
            function onEnterFrame(event:Event):void
                {
                    trace("enterFrame")//**[COLOR=Red]<<<this Works[/COLOR]**
                }
            //function onKeyDowny(event:KeyboardEvent):void
// {
// }
            function onKeyUp(event:KeyboardEvent):void
                {
                }
            //buttonToIntroScreen.x=100;
// buttonToIntroScreen.y=100;
// addChild(buttonToIntroScreen);
// buttonToIntroScreen.addEventListener(MouseEvent.CLICK,handleClick);
            
            //trace("menuScreenHere");
            //needs buttons that effect :fuel repair goods
            //needs to show current weight and efficiency
            //needs to show btrace("");ank account
            //needs to choose route
            //needs a button that starts the level
            //start level x
            
        }
        //public function handleClick(evt:MouseEvent):void
// {
// //trace("MenuScreenHandleClick");
//// customEvent=buttonToIntroScreen.fireString;
//// trace(customEvent);
//// dispatchEvent(new Event(customEvent,true));
// }
//    
        
    }
}

```
