How do I make a global var outside of a class?
You donβt.
Maybe you could make a class named βGlobal
,β and put static variables in that?
1 Like
These are for non-static changing varibles and I cannot access the stuff from it without having an instance of it? and for a new instance it would reset all varibles.
You can do static/global variables like this:
class MyClass {
public static var hello = "Hello World";
}
Elsewhere, you can reference it like this:
trace (MyClass.hello);
If the class is under a package, you will need to either refer to your.full.packagename.MyClass
or you can import your.full.packagename.MyClass
before referencing it