I don't know if this is too difficult or too easy. My custom component is trying to listen to the main application's state changes using StateChangeEvent.CURRENT_STATE_CHANGE, but it's reporting its own state changes.
Any idea how I could do this?
I don't know if this is too difficult or too easy. My custom component is trying to listen to the main application's state changes using StateChangeEvent.CURRENT_STATE_CHANGE, but it's reporting its own state changes.
Any idea how I could do this?
addeventlistener adds the listener to that object. To add to a diferent instance you have to use myobject.addEventListener() so you need to pass a reference to the MainApp instance you want to listen to, or pass things through stage (as long as both are on the display list).
Application.application
will give you a reference to the main application, thus you should use Application.application.addEventListener(...)
to listen to stage changes within the main application.