3 Replies Latest reply on Mar 15, 2012 11:21 PM by Patel Bharat

    PopUpManager issue

    jfb00 Level 3

      Hi,

      I am getting an error in flex sdk 4.6 for PopUpManager, i am trying to center the window, it works in sdk 4.5.1.

      If I use this instead of this.parentDocument as DisplayObject, it works but it doesn't center the window.

       

      win=My_Screen(PopUpManager.createPopUp(this.parentDocument as DisplayObject, My_Screen, true));

      PopUpManager.centerPopUp(win);

       

      Any ideas?

      Thanks!

        • 1. Re: PopUpManager issue
          Sathyamoorthi Level 2

          what "this.parentDocument" refres? popup will be centered to "this.parentDocument".

          • 2. Re: PopUpManager issue
            jfb00 Level 3

            Thanks for you help and reply.

            I have an app that will have a controlBarContent at top and a module at the bottom.

            From the module i want to open this popUp screen, it works but it is centring the only in the module not in the whole browser screen.

            With this.parentDocument i point to the main app but looks like it is different in sdk 4.6. i try also this.parentApplication and it works but also centering on the module.

            I hope someone can help.

            Best,

            • 3. Re: PopUpManager issue
              Patel Bharat Level 2

              Hi try below code, which will open center popup window

               

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                               xmlns:s="library://ns.adobe.com/flex/spark"

                                               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

                        <fx:Declarations>

                                  <!-- Place non-visual elements (e.g., services, value objects) here -->

                        </fx:Declarations>

               

                        <s:controlBarContent>

                                  <s:Button id="btn"

                                                        label="Show TitleWindow"

                                                        click="btn_click(event);" />

                        </s:controlBarContent>

               

                        <fx:Script>

                                  <![CDATA[

                                            import MyTitleWindow;

                                            import mx.managers.PopUpManager;

               

                                            protected function btn_click(evt:MouseEvent):void {

                                                      var ttlWndw:MyTitleWindow = PopUpManager.createPopUp(this, MyTitleWindow, true) as MyTitleWindow;

                                                      PopUpManager.centerPopUp(ttlWndw);

                                            }

                                  ]]>

                        </fx:Script>

              </s:Application>

               

              MyTitleWindow component as below:

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:TitleWindow name="MyTitleWindow"

                                               xmlns:fx="http://ns.adobe.com/mxml/2009"

                                               xmlns:s="library://ns.adobe.com/flex/spark"

                                               xmlns:mx="library://ns.adobe.com/flex/halo"

                                               title="Spark TitleWindow title"

                                               width="300" height="200"

                                               close="ttlWndw_close(event);">

               

                        <fx:Script>

                                  <![CDATA[

                                            import mx.core.IFlexDisplayObject;

                                            import mx.events.CloseEvent;

                                            import mx.managers.PopUpManager;

               

                                            protected function ttlWndw_close(evt:CloseEvent):void {

                                                      PopUpManager.removePopUp(evt.currentTarget as IFlexDisplayObject);

                                            }

                                  ]]>

                        </fx:Script>

               

              </s:TitleWindow>

               

              Hope this could be helpful.