Accessing the Document Class

Here’s a really simple method to access your Document class from anywhere in a project. This method will only work if that Class is instanced only once.

Add a public static var to the class, which in this example is name “Main”:

public static var main:Main;

Set the value for the new variable to reference your class instance with “this”:

main = this;

From here you can access any public method or property of the Main class with:


Leave a Reply

Your email address will not be published. Required fields are marked *