4 Replies Latest reply on Apr 4, 2008 2:23 AM by Starlover_jacob

    PopUpManager.centerPopUp(this)

    Astronax
      A. ROOT APP
      B. [loaded from A] Application Control Bar (component)
      C. [loaded from B] Popup form (component)

      Inside the popup I have this PopUpManager.centerPopUp(this); executed onCreationComplete.
      However it is centering on the control bar, how can I center to the ROOT app?

      Thanks
        • 1. Re: PopUpManager.centerPopUp(this)
          Garyl Woolworth Level 1
          Hey I wrote my own centerPopUp function to accomplish this exact task.

          // CENTER POP UP TO SCREEN NOT PARENT
          public function centerPopUp(displayObject:Object):void {
          displayObject.x = Math.round((screen.width / 2) - (displayObject.width / 2));
          displayObject.y = Math.round((screen.height / 2) - (displayObject.height / 2));
          }

          Call it the same way you are calling it via PopUpManager. On creationComplete="centerPopUp(this)" from the pop itself.
          • 2. Re: PopUpManager.centerPopUp(this)
            riesvantwisk Level 1
            I never tried it,
            but can you not simply give the application as teh parent??

            Ries
            • 3. PopUpManager.centerPopUp(this)
              Bryan Dresselhaus
              Try this, where component is the object to pop up.

              mx.managers.PopUpManager.addPopUp(component, UIComponent(container.parentApplication), true);
              mx.managers.PopUpManager.centerPopUp(component);
              • 4. Re: PopUpManager.centerPopUp(this)
                Starlover_jacob Level 1
                Hi,
                I used the following code:

                --------------
                myTitleWindow = new TitleWindow();
                myTitleWindow.title = "My Window Title";
                myTitleWindow.width= 220;
                myTitleWindow.height= 150;
                PopUpManager.addPopUp(myTitleWindow,Application.application as Sprite, true);
                PopUpManager.centerPopUp(myTitleWindow);


                PopUpManager.removePopUp(myTitleWindow);

                --------------

                I call the popup to show when an image is loaded and processed as a thumbnail.. this takes a while, so i show the popup during executing code.. when he is done i remove the popup.

                The problem i have is that when i go over the same code again, the popup does show when he likes it.. so he shows it the first or second time, but it could be that the third time i run the same code, it only shows a gray screen..( like the background app when you show an alert window)

                someone any idea on how to solve this? Or perhaps another way to notify the user he must wait..

                Greets, jacob