开发者

Flex PureMVC: Mediator not registering

开发者 https://www.devze.com 2022-12-19 06:43 出处:网络
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 onRegist开发者_St

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 onRegist开发者_StackOverflow社区er() 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. :)


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.


Thanks, Mike!!! After posting here, I did a few more research and I came up with the same conclusion. I didn't have the pureMVC source code in the project I'm working on, and since the project is using pureMVC v.1.0, I didn't know if I could still get the source code for that. It'll be upgraded to v.2 soon.

Anyways, I assigned a unique name to the mediator and assigned that unique name as the id of the component. Here is the link to where it helped me debug:

http://forums.puremvc.org/idex.php?topic=596.0

Hopefully, it'll be useful to other pureMVC noobie (like me) in the future. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消