Issue: IMediatorMapping.autoRemoveEnabled not working with extension Starling View Map

Stephan's Avatar

Stephan

27 Nov, 2013 11:36 AM

Hi!
I am using the default extension Mediator Map together with the extension Starling View Map (https://github.com/jamieowen/robotlegs2-starling-viewmap).
This is causing the IMediatorMapping.autoRemoveEnabled to not work anymore.
The reason is the handling of autoRemoveEnabled in the Mediator Map.
In my opinion it should be applied when a mediator is going to be removed and not when the mediator is created.

I think the current handling is even a bug.
When having more then one Mediator mapped to a view, but you only want to auto remove one of them, you would unmediate all mediators even if you set autoRemoveEnabled to false for the other Mediators.

I created a fix by creating an extension overriding the Mediator Map extension, but it is kind of dirty.
Find attached the Mediator Map extension with the fix.
It would be nice if you could fix this in the Mediator Map extension directly.

Suggestion how to fix Mediator Map:

MediatorManager.as

public function removeMediator( mediator:Object, item:Object, mapping:IMediatorMapping ):void
{
    // the fix:
    if (!mapping.autoRemoveEnabled)
    {
        return;
    }

    const displayObject:DisplayObject = item as DisplayObject;

    if (displayObject)
        displayObject.removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);

    if (mediator && mapping.autoRemoveEnabled)
        destroyMediator(mediator);

}
  1. Support Staff 1 Posted by Ondina D.F. on 28 Nov, 2013 09:21 AM

    Ondina D.F.'s Avatar

    Hi Stephan,

    Could you please open an issue here:
    https://github.com/robotlegs/robotlegs-framework/issues

    Ondina

  2. 2 Posted by krausste on 28 Nov, 2013 11:57 AM

    krausste's Avatar

    Hi Ondina,

    Issue has been created:
    https://github.com/robotlegs/robotlegs-framework/issues/158

    Stephan

  3. Support Staff 3 Posted by Ondina D.F. on 28 Nov, 2013 04:56 PM

    Ondina D.F.'s Avatar

    Good:)

  4. Ondina D.F. closed this discussion on 28 Nov, 2013 04:56 PM.

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

Keyboard shortcuts

Generic

? 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