Deferred Instantiation problem with "stack" components

ndcollins's Avatar


09 Feb, 2010 05:30 PM

If you have your view component that is associated with a mediator added as a direct child of a stack component ( ViewStack, TabNavigator, etc.) then you will have problems doing much with the onRegister() method as any references to children of the view component will come back null for all but the initially selected child view.

The problem appears to be around the fact that the stack component initializes the views, but does not create it's children components until the view is shown.

One possible workaround could be to map a listener to the FlexEvent.SHOW event of the view, and have the handler add any listeners that are needed, but it would be even nicer if the MediatorBase was able to check for this use case in its preRegister method and respond accordingly.

  1. Support Staff 1 Posted by Joel Hooks on 09 Feb, 2010 05:37 PM

    Joel Hooks's Avatar

    The problem with doing anything in MediatorBase like this is that it ties to the Flex framework. I've been considering making a Flex utility library that extends these classes (MediatorMap and MediatorBase) to add Flex specific functionality.

  2. Joel Hooks closed this discussion on 09 Feb, 2010 05:37 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac