Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6066869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:32:46+00:00 2026-05-23T09:32:46+00:00

When my focus is inside the input text field, pressing CTRL+ENTER works but ENTER

  • 0

When my focus is inside the input text field, pressing CTRL+ENTER works but ENTER does not.

Pressing Enter when my focus is anywhere BUT the input text field works just fine..

My intention is to detect if ENTER key was pressed after the user fills out the field, but it seems to only work for CTRL+ENTER

ActionScript 3:

// works:
stage.addEventListener(KeyboardEvent.KEY_DOWN, enterHandler);

// ignored:
email.addEventListener(KeyboardEvent.KEY_DOWN, enterHandler);

function enterHandler(event:KeyboardEvent):void{
    if(event.keyCode == Keyboard.ENTER ){
        email.text = 'Thanks!';
    }
}

ENTER results in charCode == 0, whereas CTRL+ENTER is charCode == 13

email was created using the Text tool and set to “Editable”

Note: I am testing in Chrome and Firefox running Flash v10

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:32:47+00:00Added an answer on May 23, 2026 at 9:32 am

    i’m assuming you’re debugging your work in ADL (Control > Test Movie > in Flash Professional)? the problem here is that the keyboard shortcuts have precedence over keyboard events and the enter key is the keyboard shortcut for Control > Play in the Control menu while you are testing your movie.

    however, it’s possible and very easy to disable the keyboard shortcuts while testing your movie. when your movie is playing, goto Control > Disable Keyboard Shortcuts. now your keyboard event for the enter key will execute properly.


    [EDIT]

    oh, and you should use event.keyCode instead of event.charCode.

    [EDIT #2]

    ok, if you want Enter keyboard event to fire when your currently inside an input TextField, you simply have to add TextEvent listener to the TextField:

    import flash.events.TextEvent;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFieldType;
    
    var tf:TextField = new TextField();
    tf.border = true;
    tf.multiline = true; //Must be set to true for the textField to accept enter key
    tf.type = TextFieldType.INPUT;
    tf.width = 200;
    tf.height = 20;
    
    tf.addEventListener(TextEvent.TEXT_INPUT, keyboardReturnHandler);       
    
    function keyboardReturnHandler(evt:TextEvent):void
        {
        if  (evt.text == "\n")
            {
            evt.preventDefault();
            trace("text field enter");
            }
        }
    
    addChild(tf);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

By clicking inside the input field or focus on the input field, how to
Just want some direction really. Want my search box to have text inside, but
Using jquery how do I focus the first element (edit field, text area, dropdown
I've got problems with setting focus to an input field after validating it. I've
What I want to do is display an input field with the text color
I'm trying to select a text field inside the tab, when the tab is
How do I select/highlight the default value inside the input on focus? thanks
I have a simple txt input field: <input type="text" name="" value="http://google.com" /> If i
I'm trying to programmatically select a substring of text inside of an input text
I'm using datepicker inside my input , my last field is the datepicker input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.