Search code examples
apache-flexpuremvcmediator

Flex PureMVC: Mediator not registering


A component is created at runtime and a mediator is created and registered. All is well.

In a separate view, another instance of that component is created. The mediator is created but onRegister() isn't called the 2nd time. I don't know if this is normal... but if it is, how do I get it to call onRegister() the second time? Thanks. :)


Solution

  • I suspect the mediator name not unique, in which case the second mediator is not registered.

    From the PureMVC View class:

    public function registerMediator( mediator:IMediator ) : void
    {
       // do not allow re-registration (you must to removeMediator fist)
       if ( mediatorMap[ mediator.getMediatorName() ] != null ) return;
       ...
    

    For more help with how to assign the mediator a unique name, it would be good to see a little more of how you're trying to instantiate and register your mediator.