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

  • SEARCH
  • Home
  • 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 7737395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:59:08+00:00 2026-06-01T07:59:08+00:00

I have a webpage with a flash header. In the flash header (block), different

  • 0

I have a webpage with a flash header. In the flash header (block), different dropdownmenus are present together with a ‘submit’ button.

When the user presses ‘enter’, i want to submit the form.
However, I can’t seem to be able to catch any key :

stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownFunc); 
root.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownFunc); 
optiesPanelNew.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownFunc); 
optiesPanelNew.ddOptiesMerk.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownFunc); 

function onKeyDownFunc(evt)
{
    if (evt.keyCode == Keyboard.ENTER)
    {
        submitForm();
    }
}

This javascript works if the html part of the page (non flash) has focus :

document.body.onkeydown = function theFunction()
{
    alert("keydown");
}

Edit: Oh no, the flash file was written in AS2 … sorry :-/
FYI : the code I ended up using was : (AS2) :

var keyListener:Object = new Object();
keyListener.onKeyDown = function():Void
{
    if(Key.getCode()==13)
        submitForm();

}

Key.addListener(keyListener); 
  • 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-06-01T07:59:10+00:00Added an answer on June 1, 2026 at 7:59 am

    I think you need to specify the event’s type in the handler (i.e. KeyboardEvent) because this way the dispatched object will be cast to a Event object when its instance is passed to the handler. The Event class doesn’t have the keyCode property, and subsequently the condition to submit the form is not met. That’s why the form doesn’t get submitted.

    So, try replacing the

    function onKeyDownFunc(evt)
    

    line, with

    function onKeyDownFunc(evt:KeyboardEvent)
    

    and it should do the trick.

    Have a great day.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webpage where I want the user to see a new image
I have a flash file that I want to embed on a webpage, however,
I have a flash video player in a div inside a webpage, I'm trying
I have a webpage that implements a set of tabs each showing different content.
I have a flash .swf file that I embed on my webpage. On my
I have a JavaScript function that loads a flash movie into a webpage div
I have this code for reading webpage. I need to send http header to
I want embed a video in a webpage. I don't want to use flash
Is it possible to have a flash/html5 video on a webpage, and when the
I want to know who refers my webpage, so in my models I have:

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.