need for ApplicationMediator?

's Avatar


10 Apr, 2010 12:27 AM

In PureMVC I ALWAYS make use of an ApplicationMediator, which in turn initializes other Mediators used by the application.

1 Is use of an ApplicationMediator discouraged in Robotlegs?
2 Is it a best practice to always auto instantiate mediators, ie instantiate the views which in turn instantiate's the mediators.
3 I'm confused ny the use of mediatorMap.createMediator. When is this necessary?

  1. Support Staff 1 Posted by Joel Hooks on 10 Apr, 2010 01:21 AM

    Joel Hooks's Avatar

    I generally mediate the main application. The contextView is a special case in regards to mediation. It is mediated * immediately* when it is mapped.

    Automatic mediation is a convenience. It eliminates the need for createMediator in most cases. Popups and AIR windows are notable exceptions. By default auto-mediation is set to true and as your views are added to the display list the MediatorMap checks for mappings and mediates them for you. This has some ramification is terms for performance for critical applications such as games or heavy data-visualization. Typical Flex applications won't suffer.

    createMediator is necessary when you turn auto-mediation off when mapping, when you create popups using the Flex PopUpManager, or when you create AIR windows. Popups and AIR windows are created off the main display list, so the auto-mediation cannot receive the added to stage events to call createMediator for you.

  2. Joel Hooks closed this discussion on 10 Apr, 2010 01:21 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac