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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:13:38+00:00 2026-06-10T10:13:38+00:00

I’m making a small game in as3. The game contains 10 levels. When i

  • 0

I’m making a small game in as3.

The game contains 10 levels.

When i enter 1 level everything is alright. But when i enter the second level (frame) the event listeners from the first frame are still working and a recieve a warning saying ‘ Cannot access an object of null objct reference’. This is because i delete every object of the first level and th add the objects from stage 2.

I’ve tried using removeEventListeners, but it doesn’t work, cause ENTER_FRAME Listeners work one more time after I remove the Event Listeners.

I’ve tried using different frames for different levels, bit it doesn’t work. Also i tried using 1 frmae for all 10 frames, but i recieve much many warning and the Flash Loader is overloaded.

How can i switch through levels (back and forward)? Thanks in advance.

  addEventListener(Event.ENTER_FRAME, subtracting2);
     arrListeners.pop(); // poping it out of the array because it will be deleted after the count reaches 0
     function subtracting2 (e:Event):void
     {
        count--;
        var FAcoef:Number = count/30; //
        FadeAway.alpha = FAcoef; //                   Some effect like FadeAway
        setChildIndex(FadeAway, numChildren - 1); //
        if(count == 0)
       {
            setChildIndex(FadeAway, 0);
            removeEventListener(Event.ENTER_FRAME, subtracting2);
        }
    }
  • 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-10T10:13:39+00:00Added an answer on June 10, 2026 at 10:13 am

    There is no built-in way to remove all listeners.

    You could use weak references to let the listeners be removed when the object is Garbage Collected.

    object.addEventListener( ……, ……., false, 0, true );

    Or you could add the removeAllListeners functionality yourself, here is some info (Have a look at Ion comment)

    But.. you shouldn’t need any of the above if you take care to remove every event listener straight away when it is not needed any more.

    If you have a class with one or more event listeners which are needed till the end of the instance’s life, you should create a destroy() function. In that destroy() function you would remove all the event listeners.

    In your case, you could call destroy() before you go to second level(frame).

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

Sidebar

Related Questions

I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have an array which has BIG numbers and small numbers in it. I
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.