Robolegs 2 and Flex popup

barmalei4ik's Avatar

barmalei4ik

02 Feb, 2012 06:17 AM

Hi,

I have created Title window with one button on it and two mediators, for window and for button.
In the AppConfig I have linked views and mediators:
mediatorMap.map(TestPopupWindow).toMediator(TestPopupWindowMediator); // popup window
mediatorMap.map(TestPopupButton).toMediator(TestPopupButtonMediator); // and button on it

Than I do standard procedure for opening popup window:
var w:TestPopupWindow = new TestPopupWindow();
PopUpManager.addPopUp(w, FlexGlobals.topLevelApplication as DisplayObject);

In the result popup is open but it does not work, mediators does work as it is expected.
What I am missing here?

In the Introduction to Robotlegs 2 presentation I found information about View Management :
33. .view management
34. viewManager.addContainer(contextView); viewManager.addHandler(mediatorMap); viewManager.addWatcher(stageWatcher); viewManager.addContainer(myPopUp); wire view handlers to view watchers
35. viewManager.addContainer(contextView); viewManager.addHandler(mediatorMap); viewManager.addWatcher(stageWatcher); viewManager.addContainer(myPopUp); wire view handlers to view watchers viewManager.addContainer(myPopUp); viewManager.addContainer(myAIRWindow); native support for flex popups and air windows.

Could you please explain how to use it? where do I need to initialize view manager?

Thank you in advance.
Denis.

  1. Support Staff 1 Posted by Shaun Smith on 02 Feb, 2012 02:59 PM

    Shaun Smith's Avatar

    Hello Denis,

    The ClassicRobotlegsBundle configures the ViewManager for you. All you need to do is inject it and add the popup as a container (be sure to remove it afterwards as well):

    [Inject] public var viewManager:IViewManager;
    // .. //
    var w:TestPopupWindow = new TestPopupWindow();
    PopUpManager.addPopUp(w, FlexGlobals.topLevelApplication as DisplayObject);
    viewManager.addContainer(w);
    

    Hope that helps!

  2. 2 Posted by barmalei4ik on 03 Feb, 2012 03:22 AM

    barmalei4ik's Avatar

    Hello Shaun,

    Unfortunately your example did not work, mediation is not happening. But I found what is wrong. I just needed to "addContainer" before adding popup on stage. In this case all my popup mediating are working properly.

    [Inject] public var viewManager:IViewManager;
    // .. // var w:TestPopupWindow = new TestPopupWindow();
    viewManager.addContainer(w);
    PopUpManager.addPopUp(w, FlexGlobals.topLevelApplication as DisplayObject);

  3. Support Staff 3 Posted by Shaun Smith on 09 Feb, 2012 04:58 PM

    Shaun Smith's Avatar

    Sounds like this is resolved. Closing this discussion - if you have more questions, you can re-open, or start a new discussion.

  4. Shaun Smith closed this discussion on 09 Feb, 2012 04:58 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