Singletons Data Models.  An interaction in Mainbox sets a property in the model 
that other views like LoginBox are listening to.

You'll also be happier the day you try to wire up the BrowserManager to handle 
backbutton and deep linking if you have a central data model.

From: [email protected] [mailto:[email protected]] On Behalf 
Of weezee49
Sent: Saturday, January 31, 2009 7:07 PM
To: [email protected]
Subject: [flexcoders] passing events to sibling components


In my Application I have a ViewStack. The ViewStack has 2 children:
SplashBox and MainBox. SplashBox has a VBox, which has an Accordion,
which has two children, LoginBox and AccountCreateBox.

In MainBox I trigger a logoutEvent by clicking a button. Among other
things, I want to clear the fields in LoginBox as a result of this
event. The only way that I have found to do this is to have an init()
function in LoginBox that is called on creationComplete and looks like
this:

private function init():void{
parent.parent.parent.parent.parent.addEventListener("logoutEvent",clearFields);
}

This seems inelegant and awkward. If I make any changes in my
structure, I'm going to have to remember to change the init function
as well.

Is there a better way?

TIA!
LG

Reply via email to