Hey,
I'm having a bit of a problem.
I have an Air application which can be minimized to system tray.
But the problem is... how do I restore it?
I've been searching for days, but can't seem to find anything that might be helpful. I've also checked the developers guide.
So... the question is,
How do I restore my application?
-----
ANSWER was:
How are you "minimizing" your main UI?
Are you calling NativeWindow.minimize(), setting NativeWindow.visible = false, or are you destroying the window?
- In the first case restoring the window is as easy as calling NativeWindow.restore().
- In the second, setting NativeWindow.visible = true, should do the trick.
- In the third you will need to manually create the window - lots of details to doing that - which you can read about here: http://livedocs.adobe.com/flex/3/html/help.html?content=WorkingWithWin dows_1.html
If you are actually wondering about how to listen for mouse events on the SystemTrayIcon - you can do that by calling SystemTrayIcon.addEventListener(ScreenMouseEvent.MOUSE_DOWN) - or by adding a menu to the SystemTrayIcon and handling menu selections.
You can read more about working with the SystemTrayIcon here:http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63 e3d118666ade46-7dcc.html
Hope this helps,
Chris Thilgen
AIR Engineering
-----
-- The above question was partially answered, but I didn't seem to have any reply to my second question... which is:
I''ve tried doing this,
But I've failed doing so.
The application window is being destroyed..
I would like to do .visible = false.
I've tried doing it like this:
var app = air.NativeApplication.nativeApplication; app.addEventListener(air.Event.EXITING, closeHandler); function closeHandler(event) { event.preventDefault(); this.visible = false; }
But after I do this, I can't do this.visible = true again.
TypeError: Value undefined does not allow function calls.
Using just alert also fires the same error.
I'm using HTML and Javascript
It seems like EXITING is fired AFTER the window has been closed..