PureMVC Architects Lounge

Announcements and General Discussion => Fabrication => Topic started by: marks416 on December 09, 2008, 10:28:21



Title: May I use routeNotification in same file(module)?
Post by: marks416 on December 09, 2008, 10:28:21
I have the code in same file that is a mediator

static public const SEND_MESSAGE:String = "sendMessage";

routeNotification(SEND_MESSAGE, null, null, "*");

public function respondToSendMessage(note:INotification):void {
    trace("respondToSendMessage");
}

I already add the code in main page

override public function getClassByName(path:String):Class {
   return getDefinitionByName(path) as Class;   
}

But I do not know why I can not handle the notification in respondToSendMessage.
I can not trace message after I call routeNotification.

Please help me

Thanks

Mark


Title: Re: May I use routeNotification in same file(module)?
Post by: Jason MacDonald on December 09, 2008, 11:25:38
routeNotification() is only sent out to other modules, not itself. For internal module messaging use the sendNotification() like you do with a normal PMVC app. This helps keep a clean separation between inter-module messaging and external module notifications.


Title: Re: May I use routeNotification in same file(module)?
Post by: Darshan Sawardekar on December 10, 2008, 07:31:49
Yes this is by design. Loopback messages are dropped. Use sendNotification within a module.

peace,
darshan