But I still have a problem calling a public method in Login from MainBox. Because MainBox is in a different branch of the tree, it can't see Login without some convoluted getChildAt().getChildAt(), and so on.
Just to clarify, my diagram didn't come through. Application has a ViewStack, which has SplashBox and MainBox. SplashBox has a VBox which has an Accordion, which has LoginBox and CreateAccountBox. This code worked in the Application: var vbox:UIComponent = splashBox.getChildAt(0) as UIComponent; var accord:UIComponent = vbox.getChildAt(3) as UIComponent; var loginBox = accord.getChildAt(0); loginBox.clearFields(e); But again, it seems inelegant, and not very robust if I have to change the structure later. Thanks, LG --- In flexcoders@yahoogroups.com, Mark Doberenz <dobiea...@...> wrote: > > I tend to create a public method on my Login screen called reset() or > something like that.Then, I can easily call it to reset that form. > > Mark > > On Sat, Jan 31, 2009 at 8:58 PM, weezee49 <rainygl...@...> wrote: > > > 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 > > > > > > >