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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:44:50+00:00 2026-05-20T01:44:50+00:00

I have recently started making (and am still making) the transition from ActionScript 2

  • 0

I have recently started making (and am still making) the transition from ActionScript 2 to 3. I have used the _global variable in an AS2 project as I needed a variable to be accessible from within ANY swf loaded into my main movie. This worked like a treat.

However, along came AS3 and whipped that from right under my feet. After much Googling, a few people suggested making use of a simple class with a simple variable that can be publicly set and retrieved. I made a simple class, imported it and manipulated the value, and all went well, however the instance of the class I create in my main loader movie is still not accessible from within a second SWF that gets loaded into my movie. If I re-instantiate the class in the SWF that is being dynamically loaded, the value reverts to the default value in the class code, not the new value set in my parent (first) movie.

Here is my class code, stored in an external .as file, is there any way I can simulate the ostype variable being a global variable?

package{
    public class ostype {
        public var ismac:Boolean = false;
        public function returnOs(){
            return ismac;
        }
    }
}

If it helps to know the context of the code, it’s used as a simple identifier as to what operating system this flash app is being used on (mac or windows) and as a result let’s me server content – such as saving files – in a different manner.

Thanks for any guidance.

Simon

  • 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-20T01:44:51+00:00Added an answer on May 20, 2026 at 1:44 am

    Use static variables:

    package {
        class GlobalVars {
            public static var isMac:Boolean = false;
        }
    }
    

    You can then access any member like this: GlobalVars.isMac = true;.

    Also, you could have a static function returning the OS (although Capabilities.os should do the trick for you).

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

Sidebar

Related Questions

I have recently started working on a very large C++ project that, after completing
I currently have a recently started project in development with a 2010 target date
I have recently started to tinker with Project Euler problems and I try to
I have recently started work on a project that has already been running for
I have recently started having problems with TortoiseCVS, or more specifically with plink, the
I have recently started using Vim as my text editor and am currently working
I have recently started looking into Google Charts API for possible use within the
I have recently started learning F#, and this is the first time I've ever
I have recently started exploring Maven, but I feel a bit overwhelmed of all
I have recently started working with Unified Communication Managed API 2.0 (UCMA) and Office

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.