1 Reply Latest reply on Jan 15, 2010 9:04 AM by Mike6679

    Click Desktop icon event handler

    Mike6679 Level 1

      Is there any way to handle a user clicking the desktop icon? What I need to do is when the user clicks the desktop icon and if the app is already running (by means of icon in the system tray) then pop up the application and not start a new instance.

       

      thanks

       

      -Mike

        • 1. Re: Click Desktop icon event handler
          Mike6679 Level 1

          Figured this out ....you need to handle the NativeApplication Invoke Event...

           

           

          public

           

          function onApplicationComplete(event:Event):void

          {

              

           

               //if user starts a second instance of THIS APP we want to handle the event:

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

          }

          //--------------------------------------

          public

           

          function OnNativeAppInvoke(evt:Event):void

          {

             //I popup my app here

           

              undock(evt);

           

          }

           

          //--------------------------------------

          public

           

          function undock(evt:Event):void

          {

           

                //After setting the window to visible, make sure that the application is ordered to the front, //else we'll still need to click on the       application on the  askbar to make it visible

               stage.nativeWindow.visible =

          true;

               stage.nativeWindow.orderToFront();

          }

           

           

          If anyone finds answers to their own questions please post them as it helps everyone out.....Thanks!

           

          -Mike