Adobe AIR. Open app from tray with double click
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.native开发者_JAVA技巧Application.icon).addEventListener(MouseEvent.DOUBLE_CLICK, unDock);
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.
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();
}
精彩评论