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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:14:33+00:00 2026-05-23T11:14:33+00:00

I wonder what benefits gives making stage non-static reference in each object instead of

  • 0

I wonder what benefits gives making stage non-static reference in each object instead of making it global. Because of that I have only problems with dereferencing null. But, there must be case why Adobe crew made it that way. So, can someone explain me that behaviour? And what problems can I have when I use something like the following code, and use gStage everywhere I need stage?

package
{
    public var gStage: Stage;
    public class Main extends Sprite;
    {
        public function Main()
        {
            if (stage)
                init();
            else
                stage.addEventListener (Event.ADDED_TO_STAGE, init);
        }
        public static function init(): void
        {
            stage.removeEventListener (Event.ADDED_TO_STAGE, init);
            gStage = stage;
        }
    }
}

By the way, why in every AS3 code sample I’ve ever seen Main extends Sprite?

  • 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-23T11:14:33+00:00Added an answer on May 23, 2026 at 11:14 am

    Although each Flash movie usually has a single stage on which visible display objects are drawn, there is not just a single “global” stage in AIR applications; each window has its own stage, and hence each window object has to have its own instance reference to its own stage. It wouldn’t be right to make a single static global stage object in that case — what if an AIR application requires multiple windows?

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

Sidebar

Related Questions

Wonder what the difference between: static PROCESSWALK pProcess32First=(PROCESSWALK)GetProcAddress(hKernel,Process32First); ... pProcess32First(...); what is hKernel? Look
wonder whether someone can help me with the following one... I have a struct
The benefits to having a vector of reference-counted smart pointers are many. I no
So I've been looking into full development object oriented JavaScript practices, and wonder about
Many of us have been indoctrinated in using XML for storing data. It's benefits
Wonder if someone could give me a quick hand. I have 2 select queries
I have a complex data model (for EF 4.1 code first) that uses composition
I wonder how many of you have implemented one of computer science's classical algorithms
Wonder if anyone can help me with this problem. I have created a Window
I wonder who has programmed using avaloq script. What are its benefits? What is

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.