2 Replies Latest reply on Apr 5, 2012 1:30 PM by Chris McLaughlin

    Minimize in MAC OS

    Chris McLaughlin Level 1

      Hi,

       

      I have a cross platform Air application developed in Flash and when running it on the MAC OS if the window is minimized, it bounces back up immediately.  I'd appreciate any ideas you may have for solving this.

       

      Best,

       

      Chris McLaughlin

        • 1. Re: Minimize in MAC OS
          tkeenanssd Level 1

          Without seeing your code, try this....works for me...

           

          your_button_name..addEventListener(MouseEvent.MOUSE_UP, minimizeProgram);

           

          function minimizeProgram(event:MouseEvent):void{

              stage.nativeWindow.minimize();

          }

          • 2. Re: Minimize in MAC OS
            Chris McLaughlin Level 1

            Hi tkeenanssd,

             

             

             

            Thanks for your reply.  I was so sure that someone would tell me that there was something quirky with the chrome that I didn’t even look at the code.  Also, I didn’t write the code so I wasn’t very familiar with it.  Anyway, your message prompted me to look and the following is what I found:

             

             

             

            //*************************************DOCK*********************************************

             

            //****************************************************************************************

             

            stage.nativeWindow.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,f ff);

             

            function fff(e:NativeWindowDisplayStateEvent):void{

             

                            if(NativeApplication.supportsDockIcon){

             

                                            if (e.afterDisplayState == NativeWindowDisplayState.NORMAL && e.beforeDisplayState == NativeWindowDisplayState.MINIMIZED) {

             

                                                            var dockIcon:DockIcon = NativeApplication.nativeApplication.icon as DockIcon;

             

                                                            NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, undock);

             

                                            }

             

             

             

                            } else if (NativeApplication.supportsSystemTrayIcon){

             

                                            if (e.afterDisplayState == NativeWindowDisplayState.NORMAL && e.beforeDisplayState == NativeWindowDisplayState.MINIMIZED) {

             

                                                            var sysTrayIcon:SystemTrayIcon = NativeApplication.nativeApplication.icon as SystemTrayIcon;

             

                                                            sysTrayIcon.tooltip = "Comcast Usage Meter";

             

                                                            sysTrayIcon.addEventListener(MouseEvent.CLICK,undock);

             

                                            }

             

                            }

             

                            if(e.afterDisplayState=="minimized"){

             

                                            dock();

             

                            } else if(e.afterDisplayState=="normal"){

             

                                            undock();

             

                            }

             

            }

             

             

             

            var icon16:BitmapData = new Icon16();

             

            var icon32:BitmapData = new Icon32();

             

            var icon48:BitmapData = new Icon48();

             

            var icon128:BitmapData = new Icon128();

             

             

             

            function dock(event:Event = null):void{

             

                            stage.nativeWindow.visible = false;

             

                            NativeApplication.nativeApplication.icon.bitmaps = ;

             

            }

             

            function undock(event:Event = null):void{

             

                            stage.nativeWindow.visible = true;

             

                            stage.nativeWindow.restore();

             

                            NativeApplication.nativeApplication.icon.bitmaps = [];

             

            }

             

             

             

            The highlighted part seemed suspicious to me, so I commented that out and amended the preceding code as follows:

             

             

             

            stage.nativeWindow.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,f ff);

             

            function fff(e:NativeWindowDisplayStateEvent):void{

             

                            if(NativeApplication.supportsDockIcon){

             

                                            if (e.afterDisplayState == NativeWindowDisplayState.NORMAL && e.beforeDisplayState == NativeWindowDisplayState.MINIMIZED) {

             

                                                            var dockIcon:DockIcon = NativeApplication.nativeApplication.icon as DockIcon;

             

                                                            NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, undock);

             

                                            }

             

             

             

                            } else if (NativeApplication.supportsSystemTrayIcon){

             

                                            if (e.afterDisplayState == NativeWindowDisplayState.NORMAL && e.beforeDisplayState == NativeWindowDisplayState.MINIMIZED) {

             

                                                            var sysTrayIcon:SystemTrayIcon = NativeApplication.nativeApplication.icon as SystemTrayIcon;

             

                                                            sysTrayIcon.tooltip = "Comcast Usage Meter";

             

                                                            sysTrayIcon.addEventListener(MouseEvent.CLICK,undock);

             

                                            }

             

                            }

             

             

             

            That solved the problem.

            1 person found this helpful