Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: routeNotification  (Read 7649 times)
quinrou
Jr. Member
**
Posts: 18


View Profile Email
« on: July 14, 2009, 08:45:35 »

Hi,

I have messing with the simple routing example located on the fabrication google code repository.

I am trying to catch the routeNotification events with the responseTo reflection and I have been unsuccessful. Her is what I am doing in the SimpleModuleMediator and FabricationRoutingDemoShellMediator I have created a new method called responseToReceiveMessage. I was expecting the the method to be executed when the the user sends a mesage by clicking one of the buttons in the shell or in the module. but nothing... Can someone help. The documentation 'using modlues' on the google code says it's possible... What am doing wrong?
I also tried to not register the receiveMessage notification with the 2 UpdateMessageCountCommand commands but the result is the same.

Is this possible or do you have to use command to talk to the different parties?

Please help.
Seb
« Last Edit: July 14, 2009, 08:57:17 by quinrou » Logged
quinrou
Jr. Member
**
Posts: 18


View Profile Email
« Reply #1 on: July 14, 2009, 09:26:03 »

if I register for the notification with the usual method (without using the reflective way).
like so, it works...

override public function listNotificationInterests():Array{
   var interests:Array = super.listNotificationInterests();
   interests.push( "receiveMessage" );
   return interests;
}

override public function handleNotification(note:INotification):void{
   switch(note.getName())   {
      case "receiveMessage":
         trace(note.getName() , "FabricationTestMediator::handleNotification" )
      break;
      
      default:
         super.handleNotification( note );
   }
}

any thoughts?
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #2 on: July 14, 2009, 09:52:29 »

There isn't enough info to say exactly what is wrong but here are a few things to keep in mind.

  • You cannot listen for routeNotification within the same module that sent it. Routes only go to other modules
  • Check that you are sending to the appropriate module in the "to" field or that you are sending to *
  • Double check that you have the correct naming convention for a respondTo method. Your example of receiveMessage would become respondToReceiveMessage
  • Check that you have properly assigned a defaultRouter to all your modules.
  • Make sure your mediator is extending the Fabrication appropriate mediator and not the PMVC one.
Logged
quinrou
Jr. Member
**
Posts: 18


View Profile Email
« Reply #3 on: July 15, 2009, 01:53:29 »

Jason,

Thanks for your response. I found what was wrong with my code.

I was using responseToReceiveMessage as opposed to respondToReceiveMessage... d'oh!

It now works like it supposed to.

thanks
S
Logged
Pages: [1]
Print