I do bind activeView, but it's not binded at the application startup, (or after the mediator instanciation).
and I actually have a mediator for each viewstack item, but I need to have several viewstacks. it's easier to explain with this:
Main.mxml contains:
- NavComponent.mxml (linked to mediator)
- InfoBarComponent.mxml (linked to mediator)
- a viewStack with (at this time) 2 view items HomeComponent.mxml and MessageBoard.mxml (both linked to related mediators)
HomeComponent.mxml contains:
- several buttons sending notifications linked to a command, and listened by MainMediator to make the viewStack switch between different views (at this time only messageBoard available)
MessageBoard.mxml contains:
- a viewStack with 3 items ListMessagesComponent, ReadMessageComponent and WriteMessageComponent (all linked to mediators)
you can then see that when I launch my app, it calls the HomeComponent in the main viewstack. We then select the "message board" button, wich calls the MessageBoard component in the main view stack.
with this, there is no problem with your method.
but if I use your method in chain (so if I call my ListMessageMediator in the MessageBoard constructor), I receive a "null" because flex seems to need a time to show the main viewstack item, and another time to show the message viewstack.
I got my solution adding a onComplete event listener in my ListMessageMediator (and so in other mediators)
do you think on an easier way?
makar