Flash Adobe AIR. Open app from tray with double click

Flash Adobe AIR. Open app from tray with double click,flash,apache-flex,actionscript-3,air,Flash,Apache Flex,Actionscript 3,Air,I've used example from here App doesn't open with double click. Works SystemTrayIcon(NativeApplication.nativeApplication.icon).addEventListener(MouseEvent.CLICK, unDock); Doesn't work SystemTrayIcon(NativeApplication.nativeApplication.icon).addEventListener(MouseEvent.DOUBLE_CLICK, unDock);

I've used example from here

App doesn't open with double click.

Works

SystemTrayIcon(NativeApplication.nativeApplication.icon).addEventListener(MouseEvent.CLICK, unDock);

Doesn't work

SystemTrayIcon(NativeApplication.nativeApplication.icon).addEventListener(MouseEvent.DOUBLE_CLICK, unDock);

#1

As alxx mentioned, this is not a bug, just a limitation.

What you should do is just listen for the click event and compare a the timestamp (getTimer()) between the 2 clicks, if under 400ms, then undock.


#2

Thanks J_A_X. :)

        SystemTrayIcon(NativeApplication.nativeApplication.icon).addEventListener(MouseEvent.CLICK, openWindow);

        private var previousTimeStamp:int;

        private function openWindow(event:Event):void
        {
            var currentTimeStamp:int = getTimer();

            if(currentTimeStamp)
            {
                if(currentTimeStamp - previousTimeStamp < 400)
                {
                    // double click
                    trace("double click");
                }
            }
            previousTimeStamp = getTimer();
        }

#3

seem like someone has reported this on an Adobe forum and didn't get much in terms of answers: forums.adobe.com/thread/100056

#4

Thank you. Please post it as answer and I'll mark it as correct answer

#5

Technically, it is not a bug, because SystemTrayIcon has click event, but not doubleClick: help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/…

#6

While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. Please read this how-to-answer for providing quality answer.