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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:45:43+00:00 2026-05-31T10:45:43+00:00

I fixed this error before where the source of the problem was that ‘stage’

  • 0

I fixed this error before where the source of the problem was that ‘stage’ was inaccessible from where I was putting the code (not in root). I deleted it and it ran fine, but the Event listeners that they were attatched to did not work anymore. I need these event listeners but when I try to put ‘stage.’ back infront it wont work. help?

This is what I had when it worked (when this file was still the root):

        stage.addEventListener(KeyboardEvent.KEY_DOWN, keypressed);
        stage.addEventListener(KeyboardEvent.KEY_UP, keyreleased);

Now my code is this, and it runs, just without the event listeners working:

        addEventListener(KeyboardEvent.KEY_DOWN, keypressed);
        addEventListener(KeyboardEvent.KEY_UP, keyreleased);
  • 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-31T10:45:44+00:00Added an answer on May 31, 2026 at 10:45 am

    The stage property is null until the element is added to the stage. So you should first listen to the event Event.ADDED_TO_STAGE, and when you receive it, you can add your other event listeners:

    addEventListener(Event.ADDED_TO_STAGE, addedToStage);
    
    function addedTostage():void
    {
        removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
        stage.addEventListener(KeyboardEvent.KEY_DOWN, keypressed);
        stage.addEventListener(KeyboardEvent.KEY_UP, keyreleased);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit : The bug that caused this problem has been fixed. The @version tag
I have a problem with IE. I have a fixed div like this: #fixed
This problem is easy fixed clientside. But for performance I want to do it
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
I've fixed this issue before (inadvertently) and I'm coming across this again. Hopefully someone
I though I had solved this problem, but it is back: Code generation for
Problem: Hibernate is not executing queries correctly. It errors with a problem that appears
I get the following error when restarting my rails app. I've had this problem
Why is this C# code not compiling? public static Dictionary<short, MemoryBuffer> GetBulkCustom(int bufferId, int
I stumbled upon an interesting error that I've never seen before, and can't explain

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.