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 4001718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:56:21+00:00 2026-05-20T07:56:21+00:00

I have a Flex application. It running in a player on the HTML-page. I

  • 0

I have a Flex application. It running in a player on the HTML-page. I need catch the key press events and prevent IE browser from acting like it wants. Here’s some code:

Actually, the part where player was layed ..

<html>
<head>
</head>

<body scroll="no" onkeydown=keypress(event)>
<noscript>
    <object id="app" width="100%" height="100%" onkeydown="keypress(event)" onkeypress="keypress(event)">
        //some params
    </object>
</noscript>
</body>
</html>

And here’s the one, where I’m trying in a different ways to catch key input:

<script language="JavaScript" type="text/javascript">

        function keypress(e) {
            alert("Hello from keypress");
        }

        function init() {
            //index
            alert("Init!!!");
            document.getElementById('app').onkeydown = function() {
                alert("Key Pressed - 1");
            };
            document.onkeydown = function() {
                alert("Key Pressed - 2");
            };

            document.getElementById('app').onkeypress = function() {
                alert("Key Pressed - 3")
            };

            document.onkeypress = function() {
                alert("Key Pressed - 4")
            };

            window.onkeydown = function() {
                alert("Key Pressed - 5");
            };
            window.onkeypress = function() {
                alert("Key Pressed - 6");
            };

            document.body.onkeypress = function() {
                alert("Key Pressed - 7")
            };

            document.body.onkeydown = function() {
                alert("Key Pressed - 8")
            };

            if (window.addEventListener) {
                window.addEventListener('keypress', keypress, false);
            } else if (window.attachEvent) {
                window.attachEvent('onkeypress', keypress);
            } else {
                window.onkeypress = keypress;
            }
        }


        window.onload = init;
        document.onload = init;
    </script>

I wasn’t going to use them all together, just gathered them all to show you that I’ve tried almost everything (also including all this with 1 parameter).

The problem is that the only Alert I’m getting is “Init!!!”. What’s wrong with it or what I’m doing wrong?

Any help would be greatly appreciated.

Edit: I get the “Init” message before the player loads it’s content .. maybe the problem is somewhere there?

  • 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-20T07:56:22+00:00Added an answer on May 20, 2026 at 7:56 am

    In Internet Explorer, events that occur within an embedded control in the <object> element do not fire equivalent events on the DOM object. They are consumed by the embedded control, and it is that control’s responsibility to handle them accordingly.

    This means, when your embedded Flex application is focussed, your JavaScript code will not be able to handle any key events.

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

Sidebar

Related Questions

I have a large flex application (the app) running on one server, and many
I have a Flex application that builds and runs from Eclipse without any problems.
We have a Flex 3 application of which the main .swf is running in
I have a Spring 2.5.6/Flex application setup and running with Spring Security 2.0.4. Recently
I have a flex application that needs the ability to generate and execute JavaScript.
I have a Flex application where I'm using a Canvas to contain several other
I have a Flex application that calls a function which searches a large document
I have a Flex application that seems larger than it should be. There is
I have a Canvas in a Flex application which has items inside it that
I would like to show some hidden text in a Flex application and 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.