 
     public function start():void {
 
-
         WebViewANESample.target.stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreenEvent);
-        NativeApplication.nativeApplication.addEventListener(flash.events.Event.EXITING, onExiting);
+        NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExiting);
+
+        if (Capabilities.os.toLowerCase().indexOf("mac") == 0) {
+            NativeApplication.nativeApplication.activeWindow.addEventListener(
+                    NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGE, onWindowMiniMaxi);
+        }
 
         if (!webView.isSupported) {
             return;

    }

    private function onDownloadComplete(event:WebViewEvent):void {
        trace(event.params,"complete");
    }

    private function onDownloadProgress(event:WebViewEvent):void {

import com.tuarua.webview.WebViewEvent;

import flash.desktop.NativeApplication;
import flash.display.NativeWindow;
import flash.display.NativeWindowDisplayState;
import flash.display.StageDisplayState;
import flash.events.Event;
import flash.events.FullScreenEvent;
import flash.events.NativeWindowBoundsEvent;
import flash.events.NativeWindowDisplayStateEvent;
import flash.filesystem.File;
import flash.geom.Point;
import flash.geom.Rectangle;
