Injected model not working in a mediated window

edeventner's Avatar


15 Nov, 2011 12:00 PM

Hello guys,

I have this problem with launching new native windows or pop-up windows because the model intended for such window is not available when injected into it. It doesn't throw an error when you inject it in, but at runtime it seems the model is not loaded simply because in my example windowed app, it didn't display the text stored in the model.

BTW, I am using the Presentation Model design pattern. It works so well with RL even though it's an MVC framework. But for using two (2) new native windows, I have to use a mediator since models are not available inside these windows.

Please let me know if you do not understand what I mean so I can give the details in my situation.


  1. 1 Posted by Daganev on 15 Nov, 2011 12:32 PM

    Daganev's Avatar

    Hi edeventner,
    Have you tried using the [PostConstruct] metadata tag before running anything to make sure all the injections are complete?

  2. 2 Posted by edeventner on 15 Nov, 2011 12:50 PM

    edeventner's Avatar

    Hello Daganev,
    Thanks for your quick response. Yeah, I've tried that after reading your response and it just works fine. I don't have problem using the model in the mediator. The problem is only when I want to use the model in the mediated windows, it does not seem available however, it seems available because it doesn't throw any runtime errors like referencing on a null object.

    Maybe I just don't get the correct strategy for this in accessing models in a mediated window.

  3. 3 Posted by edeventner on 15 Nov, 2011 01:16 PM

    edeventner's Avatar

    Wow, I never thought this would be this easy. I think I got it now. I'll just close this discussion when this really works in my live app as it does in my example app and maybe this will help somebody who may encounter this kind of situation.

    So in my mediated window/popup, this code is inside the script metadata tag:

     import mymodels.MyWindowModel;
     public var model:MyWindowModel;

    then inside my mediator, pass the injected model to the model in the window. So it goes like this:

     public var model:MyWindowModel;
     public var view:MyWindow;
     override public function onRegister():void
         view.model = model;
  4. edeventner closed this discussion on 15 Nov, 2011 01:28 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