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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:19:12+00:00 2026-05-29T20:19:12+00:00

I am developing flash game. first class: public class Game{ public var age; }

  • 0

I am developing flash game.

first class:

public class Game{
    public var age;
}

second class:

public class Display{
    Game.age  //<-- cannot retrieve
}

so how to get the variable from Game() to Display()?

  • 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-29T20:19:14+00:00Added an answer on May 29, 2026 at 8:19 pm

    See this other post about the difference between static variables and non-static variables:

    Actionscript 3: Can someone explain to me the concept of static variables and methods?

    You’re attempting to access age as a static variable, when it is, in fact, not one.

    To access it in your code, you would have to instance the Game class and then reference “age” on the instance of the class.

    After looking at this further, I feel I should point out that if you intend the “age” property of the Game class to be read-only, you should not make it public and instead create a static method on the Game class which can return the information to you.

    public class Game{
        private var age = 10;
        public static function getAge() {
            return self.age;
        }
    }
    
    public class Display{
        public function whatever() {
            trace( Game.getAge() );
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking into developing a game using the flex SDK instead of flash. I'm
I'm developing a Flash game in ActionScript 2, and the issue if that this
Hu guys, I'm developing a Flash game, and I'm interested in knowing what would
I'm developing a social game in Flash with a team of developers. Our server-side
In a Flash game I am developing, there are some settings that are set
I'm developing a flash application that is getting information from a remote server using
I am developing a game for the Android platform using flash cs5 and AS3.
I'm currently developing a flash game and I need to be able to test
I am developing a ipad game using flash CS5. When I run it in
I'm wondering if it would be useful to switch from developing in Flash IDE

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.