2 Replies Latest reply on Feb 11, 2010 9:26 PM by Flex harUI

    Way to get the Window Object from PopUpManager

    WeeJavaDude Level 1

      I have a need to resize a dialog when the user resizes the browser.  I don't want to have to manage what window was just opened and want to at the time the app gets a resize event resize the dialog that is currently open appropriatly.   Is there a way to find this out or an event I can catch within my Popped up window to then do the resize. 

        • 1. Re: Way to get the Window Object from PopUpManager
          archemedia Level 4

          Sure, this is an example of a custom component you use as a popUp window:

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" creationComplete="init()">
              <mx:Script>
                  <![CDATA[
                      import mx.events.ResizeEvent;
                      import mx.managers.PopUpManager;
                     
                      private function init():void
                      {
                          parentApplication.addEventListener(ResizeEvent.RESIZE, handleResize);
                      }
                     
                      public function handleResize(evt:Event):void
                      {
                         
                      }

           

                    private function handleClose():void

                    {

                              parentApplication.removeEventListener(ResizeEvent.RESIZE, handleResize);

                              PopUpManager.removePopUp(this)

                    }
                  ]]>
              </mx:Script>
              <mx:Button label="close" click="handleClose()"/>
          </mx:Panel>

           

          Dany

          1 person found this helpful
          • 2. Re: Way to get the Window Object from PopUpManager
            Flex harUI Adobe Employee

            Try listening to the popup's document for the resize event

             

            document.addEventListener(Event.RESIZE, ...)