2 Replies Latest reply on Nov 19, 2009 5:37 AM by SiHoop

    How to control stage resizing

    SiHoop Level 1

      My main file displays a large number of dynamically generated graphics. I have a listener to remove and then re-position the graphics if the browser is re-sized:

      stage.addEventListener(Event.RESIZE, stageResized)

       

      //When stage is resized, remove all children from the main component.
      //When empty, refresh the stage content
      public function stageResized(e:Event):void{
         while(mainUIComponent.numChildren>0){
              mainUIComponent.removeChildAt(0)
         }
              addContentToStage()
      }

       

      My problem is that the function works perfectly if I use the Browser Maximize/ Minimize buttons, but not if the window is re-sized manually by dragging the browser window at the bottom-right side. If I drag the window to resize, many graphics are left unerased on the stage, but all the new graphics are drawn leaving a terrible mess. If I go back to select the Maximize/ Minimize again, the screen is cleaned properly once more.

      Can anyone recommend an approach to clear out all the old graphics on a manual drag?