Mediators not being created for subviews when createMediator() is called on parent view being added as a popup's Avatar

27 Feb, 2013 04:35 PM

Defined in bootloader:

mediatorMap.mapView(ParentView , ParentMediator);
mediatorMap.mapView(ChildView , ChildMediator);

ParentView is being added as a popup:

var parentView:ParentView = new ParentView();
PopUpManager.addPopUp(parentView, contextView);

The view loads correctly and the the mediator for the parent view works as expected. parentView contains the child view (ChildView) which is mapped to ChildMediator.

The problem I am having is ChildMediator isn't being created like I thought it would. Do I need to create it manually just as the parent?

  1. Support Staff 1 Posted by Shaun Smith on 27 Feb, 2013 09:57 PM

    Shaun Smith's Avatar

    RL1 only watches the supplied "contextView" for new views. The problem here is that Flex puts popups on a separate branch of the display list - which RL is not watching.

    One solution is outlined here:

    Another solution is to use RL2 which allows you to add more than one container to the ViewManager.

  2. 2 Posted by on 28 Feb, 2013 06:14 PM's Avatar

    Unfortunately, RL2 isn't an option for us right now. However, I did try the suggestion from the blog post and so far it has worked perfectly.

  3. Support Staff 3 Posted by Shaun Smith on 28 Feb, 2013 11:49 PM

    Shaun Smith's Avatar

    Good stuff. I'm closing this thread for now. Please feel free to re-open, or open another, at any time.

  4. Shaun Smith closed this discussion on 28 Feb, 2013 11:49 PM.

  5. re-opened this discussion on 02 Apr, 2013 05:47 PM

  6. 4 Posted by on 02 Apr, 2013 05:47 PM's Avatar

    Just a follow up; this was my initial working code:

        <my:Context id="myContext"/>
    // called from onCreationComplete()
    private function initContext():void
        var contextView:DisplayObjectContainer = systemManager as DisplayObjectContainer;
        myContext.contextView = contextView;

    However, we ran into problems when we used automation-runtimeloading. Apparently the loading changes the systemManager, but the following change worked:

    var contextView:DisplayObjectContainer = systemManager.topLevelSystemManager as DisplayObjectContainer;
    Using the top level system manager makes everything work either loaded normally or when loaded through the automation runtime.
  7. closed this discussion on 02 Apr, 2013 05:47 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