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: URGENT: How can I get the mediator to listen to all Notifications.  (Read 2768 times)
jgervin
Courseware Beta
Sr. Member
***
Posts: 50


View Profile Email
« on: July 15, 2010, 11:27:08 »

So my stageMediator does some special things and I need it to hear all/every notification that is sent out.  Is there an easy way to do this?  So I don't have to type in all the notification interests in the listNotificationInterests Array?

Sorry about urgency, but a release is going out and requirements have changed and I don't have time to fix the code so just need to the stageMediator to hear everything.

TIA, J
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: July 15, 2010, 12:55:09 »

Requirements change at the last minute, eh? That never happens....

Well the framework doesn't really support that any more than AS3 supports a listener that hears every event that's fired. The Mediator usually only needs to be subscribed to the notes it is prepared to handle. Unless you're just printing out the name and contents of the note for debug purposes, I can't think of a reason why the StageMediator would need to be notified of *everything*. And that doesn't sound like a normal production use-case. But without knowing your motivation, I can't say if it's a reasonable thing to want to do or not.

Anyway, you could put a static convenience method (say getAllNoteNames) on the concrete facade that returns an array of all the defined notification constants. And then in the listNotificationInterests method of your StageMediator, you could just call ApplicationFacade.getAllNoteNames() and return the array.

-=Cliff>
Logged
jgervin
Courseware Beta
Sr. Member
***
Posts: 50


View Profile Email
« Reply #2 on: July 15, 2010, 02:36:56 »

The issue seems to be a bug in Flex 4 or in my head. The issue is I have a docked ApplicationControlBar, which should always be in top of the display list, but it isn't.  I have added some new popups and such, which end up showing over top the ApplicationControlBar.  These popups and things are shown based on notifications so for a shortcut to get past the release I planned on just reordering the displayList each time a notification is sent.

Guess I will just listen to all the notifications and do the long way.  Thanks for the quick response.

J
Logged
gohloum
Jr. Member
**
Posts: 16


View Profile Email
« Reply #3 on: July 23, 2010, 02:07:47 »

Dont know if this would help, but KapIT has a nice little PureMVCControlPanel which is nice for debugging.  If it's a matter of finding what notification is causing the problem, this may help as it tracks everything going on in the MVC part of the app.

Here is the URLhttp://lab.kapit.fr/display/puremvcconsole/PureMVC+Console

Logged
Pages: [1]
Print