ITeye博客

(Adobe Air) Bring a window to front by clicking the systemTrayIcon

unixboy · 2010-04-05 16:09 · Web General · Web前端 · Windows · Adobe · AIR · Markdown

While developing an AIR application, I had an issue with bringing the application to front (above all other windows) when clicking the systemTrayIcon.

Usually, you would use the method:

view source

print ?

1. systemTrayIcon.addEventListener( "click" , function () {

2. window.nativeWindow.orderToFront();

3. });

But doing so will result in… actually nothing at all. The window doesn’t move.
Using the same code on a menu item of the SystemTrayIcon will work, but not on the click action of the Icon itself.

Workaround:

Set the window property alwaysInFront to true and then to false:

view source

print ?

1. systemTrayIcon.addEventListener( "click" , function () {

2.   window.nativeWindow.alwaysInFront = true ;

3.   window.nativeWindow.alwaysInFront = false ;

4.   });

Not the way it should be, but it works…

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。