3 Replies Latest reply on Jan 29, 2010 12:32 PM by Faser

    Resize effect maintaining the window centered


      I have a TitleWindow that I open using the PopUpManager.


      I would like to apply a resize effect when I show the window.

      <mx:Resize id="expand"  widthTo="640" heightTo="480"/>

      The problem is that the TitleWindow is resized from the upper left corner to the bottom right corner. So the popup is no more centered. How can I apply the same effect but maintaining the window centered in the screen while it is resized?

        • 1. Re: Resize effect maintaining the window centered

          I don't understand completely.But below is a piece of code I wrote render a image as a zoom popup and then when i cliked on the pop up it resized to its original size. May be it can help you



          use :-

          img.addEventListener(MouseEvent.CLICK, image_click);

          img.addEventListener(ResizeEvent.RESIZE, image_resize);

          PopUpManager.addPopUp(img, this, true);




          private function image_click(evt:MouseEvent):void {
                              PopUpManager.removePopUp(evt.currentTarget as Image);


          private function image_resize(evt:ResizeEvent):void {
                             PopUpManager.centerPopUp(evt.currentTarget as Image);


          If you are using image.

          • 2. Re: Resize effect maintaining the window centered

            Or you can use a composite effect, composed from a resize effect and a move effect. If you want to resize a window with x pixels on horizontal direction and y pixels on the vertical one:

            • create a resize effect with deltax = x/2 and deltay = y/2
            • create a move effect with deltax = -x/2 and deltay = -y/2


            Hope it helps.


            1 person found this helpful
            • 3. Re: Resize effect maintaining the window centered
              Faser Level 1

              Thank you I followed your suggestion in this way:



              var myPopup:PaymentDetails = PaymentDetails(PopUpManager.createPopUp(this,net.faser.PaymentDetails,true));


              resizeEffect.widthTo = 640;
              resizeEffect.heightTo = 480;      


              myPoint.x = myPopup.x;
              myPoint.y = myPopup.y;


              moveEffect.xTo = myPoint.x - 640/2;
              moveEffect.yTo = myPoint.y - 480/2;      


              resizeAndMove.target = myPopup;       


              <mx:Parallel id="resizeAndMove">
                  <mx:Resize id="resizeEffect" />
                  <mx:Move id="moveEffect" />