In your main application:
public var myClass:CustomClass;
And then, from anywhere else:
var c:CustomClass = Application.application.myClass;
Spot on. Nice one
Two things :
- You don't need to pass the instance of the application to your CustomClass. If you need to access
it you just need to call Application.application from your CustomClass.
- The Application.application return type is Application. Your Application mxml is actually a subclass of the flex Application class, so that's ok, but in order to access your main properties you will need to cast Application.application into your custom application. You said your application name is main.mxml, so you will need to use ( Application.application as main ) or main( Application.application ) to access the Script tag public members.
The variable "myCLass" must be public