A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: KeyboardEvent

  1. #1
    Member
    Join Date
    Feb 2010
    Posts
    79

    KeyboardEvent

    In the keyboardEvent, the ENTER key is not responding.. why?.... any other option is there?

    Actionscript Code:
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
    function onKeyPressed(evt:KeyboardEvent):void {
        if(evt.keyCode == Keyboard.ENTER){
            trace("Enter key pressed");
        }
    }

  2. #2
    Senior Member
    Join Date
    Jan 2009
    Posts
    208
    Actionscript Code:
    stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler);
    function keyDownHandler (e:KeyboardEvent):void {
        trace(
        "Key code: " + e.keyCode + "\n" +
        "Ctrl status: " + e.ctrlKey + "\n" +
        "Key location: " + e.keyLocation + "\n" +
        "Shift key: " + e.shiftKey + "\n")
    }

  3. #3
    Member
    Join Date
    Feb 2010
    Posts
    79
    Quote Originally Posted by regbolD View Post
    Actionscript Code:
    stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler);
    function keyDownHandler (e:KeyboardEvent):void {
        trace(
        "Key code: " + e.keyCode + "\n" +
        "Ctrl status: " + e.ctrlKey + "\n" +
        "Key location: " + e.keyLocation + "\n" +
        "Shift key: " + e.shiftKey + "\n")
    }
    I thing this not my solution... When i pressed the "ENTER" key, i could able to get the output (trace). U understood my question?

  4. #4
    Member
    Join Date
    Feb 2010
    Posts
    79
    The "ENTER" key is responding only in swf file and browser...

  5. #5
    Senior Member
    Join Date
    Jan 2009
    Posts
    208
    Control > Disable Keyboard Shortcuts, when you test movie and enter will work in flash api

  6. #6
    Member
    Join Date
    Feb 2010
    Posts
    79
    Quote Originally Posted by regbolD View Post
    Control > Disable Keyboard Shortcuts, when you test movie and enter will work in flash api
    Ya, now its working... thank u so much..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center