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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:19:29+00:00 2026-06-08T03:19:29+00:00

I’m creating a game with AS3 in Flash Professional CS5.5. In this game I

  • 0

I’m creating a game with AS3 in Flash Professional CS5.5.

In this game I have an “again” button, so that the player can reset the level and start from new.
My problem now is:

After the clicked “again” the stage becomes null.

All I do in the “ResetLevel” method is, that I set the x and y positions of some elements back to 0, remove some items from the movieclip, but I don’t remove ALL items from the display list. So the background, the hud, the plane isn’t removed from the movieclip. Here a sketch of my displaylist. The removeable items are sometimes zero, sometimes they are 30 or more items (depends on playtime, and so on)

Displaylist:

stage
|-- Game movieclip
    |--LevelBackground
    |--Removeable item 
    |--Removeable item
    |--Removeable item
    |--Plane
    |--HUD

But after removing the “removeable items” and setting the position coordinates of levelbackground and plane the stage is null.

Maybe someone can help me to point me to a solution for this problem.

EDIT:

The “ResetLevel”-method will be called inside the “game movieclip” and the stage will be accessed from the “game movieclip”, too. So I don’t remove the “game movieclip” from the displaylist when I reset the level. I only remove some elements, that the game movieclip contains from the movieclip.

Here some pseudocode from the “game movieclip class” (GameMC):

public class GameMC extends Sprite {

    //Some properties here

    public function GameMC() {
        //Some code here

        //--Events--
        this.addEventListener(Event.ADDED_TO_STAGE, Init, false, 0, true);
        this.addEventListener(Event.REMOVED_FROM_STAGE, Removed, false, 0, true);
    }

    private function Init(e:Event) {
        this.removeEventListener(Event.ADDED_TO_STAGE, Init);
        //Some Code here
    }

    private function ResetLevel() {
        //Some Code here, too
        if(removeItemArray.length > 0) {
            for(i = 0; i < removeItemArray.length; i++) {
                currentRemoveableItem = removeItemArray[i];
                this.removeChild(currentRemoveableItem );
                removeItemArray.splice(i, 1);
            }
        }
        level.x = 0;
        level.y = 0;

        trace(stage); //Will output null
    }
}
  • 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-08T03:19:33+00:00Added an answer on June 8, 2026 at 3:19 am

    Now I used to store the stage into a property and access this:

    public class GameMC extends Sprite { 
    
        //Some properties here
        private var stagevar:Stage;
    
        public function GameMC() { 
            //Some code here 
    
            //--Events-- 
            this.addEventListener(Event.ADDED_TO_STAGE, Init, false, 0, true); 
            this.addEventListener(Event.REMOVED_FROM_STAGE, Removed, false, 0, true); 
        } 
    
        private function Init(e:Event) { 
            this.removeEventListener(Event.ADDED_TO_STAGE, Init); 
            this.stagevar = stage;
            //Some Code here 
        } 
    
        private function ResetLevel() { 
            //Some Code here, too 
            if(removeItemArray.length > 0) { 
                for(i = 0; i < removeItemArray.length; i++) { 
                    currentRemoveableItem = removeItemArray[i]; 
                    this.removeChild(currentRemoveableItem ); 
                    removeItemArray.splice(i, 1); 
                } 
            } 
            level.x = 0; 
            level.y = 0; 
    
            trace(stagevar); //Will output [Object Stage]
        } 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string

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.