1 Reply Latest reply on Dec 10, 2006 1:17 PM by Christophe Herreman

    browser window resize event

    Daniel Freeman Level 1
      Newbie question - sorry. How do I capture the browser window resize event?

      I've tried variations on this code:-

      <mx:Script>
      <![CDATA[

      import flash.events.Event;

      function mylisten():void { trace('mylisten');
      this.stage.addEventListener(Event.RESIZE,resizefn);
      }

      function resizefn():void {
      trace('resize!');
      }

      ]]>
      </mx:Script>
        • 1. Re: browser window resize event
          Christophe Herreman
          Hi brutfood,

          you can add a handler to the resize event of the application as an attribute of the Application tag.
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" resize="resizeHandler()">

          Then add the handler ("t" is TextArea):
          private function resizeHandler():void {
          t.text = stage.width + " - " + stage.height;
          t.text += "\n" + stage.stageWidth + " - " + stage.stageHeight;
          }

          Note the difference between the width/height and stageWidth/stageHeight properties: the first couple returns the actual stage dimension while the second returns the visible area of the stage.

          regards,
          Christophe