I have the following structure:
Application
|___ViewStack
|____SplashBox
|____VBox
|___Accordion
|____Login
|____CreateAccount
|____MainBox
In MainBox I dispatch a logoutEvent. Among other things as a result
of this event, I want to clear the fields in the Login component. The
only way I have been successful so far is to call an init() function
from creationComplete in Login that looks like this:
private function init():void{
parent.parent.parent.parent.parent.addEventListener("logoutEvent",
clearFields)
}
As I understand events, the logoutEvent in MainBox bubbles up to the
ViewStack, and then to the Application. Is there a better way to
force the event down to Login? Repeatedly using parent in this
fashion seems so inelegant. And if I change my structure at all, I'll
also have to remember to go into the code and change the number of
parents in the init() function.
TIA!
LG