Mediator onRemove Issues

Tyler's Avatar


08 Aug, 2014 07:30 PM

I am also facing similar issues to those who have mentioned that onRemove is not firing for them.

I am using RL 1.5.2 and Swift 1.6.0....

Adding my own Added to stage and removed from stage listeners works, so the components are getting removed from the stage, but onRemove is never being fired.

I've done tests concerning adding listeners to view signals directly and have cleaned them up using the signal mediator pattern, but to no avail. onRemove just never fires for me.

  1. Support Staff 1 Posted by Ondina D.F. on 09 Aug, 2014 08:17 AM

    Ondina D.F.'s Avatar

    There may be multiple causes for that issue. You didn't provide enough information.

    FlashPlayer version? (There was a known bug in the FP 9 regarding added to stage and removed from stage events)
    Nature of the project? - AS3 , Flex or AIR?
    What kind of a component are you using for your Views? - regular Flex components, or Sprites or custom components? Is it a Module?
    Is the View changing states? Transition effects, re-parenting?
    Is onRegister of the mediator running?
    How are you mapping your mediators? Are autoCreate:Boolean=true, autoRemove:Boolean=true ?

    Anyway, I'm thinking of your problem in the context of your other questions regarding Modules and I'm assuming that you are having trouble with the module's mediator.
    If you look carefully at Joel's example, you can see that the contexts extend ModularContext and the mediators extend ModuleMediator.

    Necessary condition to make it work:

    • Module's context extends ModularContext

    • Module's context overrides dispose() like this:

    override public function dispose():void
    • In your Module's contextView, which implements org.robotlegs.utilities.modular.core.IModule:
    public function dispose():void
        context = null;

    dispose () == [Inherited] Modules need a method for cleanup and removal of the module from memory to make them available for garbage collection.

    • Module's mediator extends ModuleMediator

    • in the REMOVED_FROM_STAGE handler of your view, call dispose()

    Without these settings, the onRemove of the modular mediator is indeed not running.

    If that wasn't your problem, then please provide more info.

  2. 2 Posted by Tyler Padley on 11 Aug, 2014 01:10 PM

    Tyler Padley's Avatar


    We found out that the problem existed in the VariantMediatorMap fork that we have… we’re considering the move to RL 2.2 in the future to harmonize our RL codebase.


    Tyler Padley

    Solutions Architect | Leonardo<>

    T 416-272-5495 | [email blocked]<mailto:[email blocked]>


  3. Support Staff 3 Posted by Ondina D.F. on 11 Aug, 2014 02:04 PM

    Ondina D.F.'s Avatar

    we’re considering the move to RL 2.2 in the future to harmonize our RL codebase.

    Yeah, good decision:)

  4. Ondina D.F. closed this discussion on 11 Aug, 2014 02:04 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