Automatic creation/removal of mediators

Stefan's Avatar


13 Dec, 2010 03:56 AM

I can't find any definitive documentation on this.
Do view components need to be directly added to the contextView to have their registered mediators created and removed automatically?
It seems to me like mediators will be automatically created even when view components are added at a level below the contextView but never removed when that view is removed from the display list.
Any help appreciated.

  1. 1 Posted by Stray on 13 Dec, 2010 09:31 AM

    Stray's Avatar

    Hi Stefan,

    I've never had any difficulty with the auto-magic creation / destruction of mediators for views added and removed within any child or grandchild (or great-great-great grandchild etc) of the contextView.

    The added/removed events bubble, so the intent is that any view within contextView can be mediated, even if deeply nested.

    Are you hitting a specific bug? Or just unsure how it would work?


  2. 2 Posted by Stefan Vizzari on 13 Dec, 2010 09:37 AM

    Stefan Vizzari's Avatar

    Hey there Stray,

    I've looked into this further and discovered that, in my situation, an overridden 'stage' getter in my component base class was causing the issue. The stage getter was always returning a valid reference to the top level stage so the removal was never being initiated by RL.

    Thanks for following up.


  3. 3 Posted by Stray on 13 Dec, 2010 10:41 AM

    Stray's Avatar

    Ah - that makes sense. It's a good 'gotcha' for the wiki as well - is the description below correct?



    View items were not having their mediators destroyed automatically when the view was removed from the stage.


    The view items had an overridden getter for the stage property. The automatic mediator removal system relies on this reference being null (or coercing to false) in order to proceed with removal.


    Check that your view class, including any base class it extends, will return null or false for the stage property when not added to the stage.


    If you could edit it if it's not correct that would be great.



  4. 4 Posted by Stefan Vizzari on 13 Dec, 2010 11:06 AM

    Stefan Vizzari's Avatar

    Nope, nothing to add, that’s a robust description ;)

  5. 5 Posted by Stray on 13 Dec, 2010 11:18 AM

    Stray's Avatar


  6. Stray closed this discussion on 11 Feb, 2011 10:42 PM.

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