Something is definitely awry with system tray menu events on Windows.

All native menu objects in AIR dispatch a “displaying” event immediately before they are displayed. This gives you the ability to update the menu. It also prevents potential issues that could occur if you try to update a native menu that is currently displayed.

However, when I attempt to listen to this event on the native menu I’ve assigned to the system tray icon, the system tray icon no longer appears in my AIR application.

Take away the event listener and the system tray icon appears. Add it back and the system tray icon disappears. It’s unbelievably strange.

Alternatively, all of this functionality works as expected in dock menus on Mac OS X. It is only an issue with the system tray menus on Windows.

To take it a step further, I’ve discovered that listening to any event on the native menu assigned to the system tray icon causes this behavior. I can listen to events on the system tray icon itself, but not on its menu (or any submenus).

As a result, I’ve been forced to modify the native menu arbitrarily when one or more of the menu items needs to change. However this introduces an entirely new (and rather unfortunate) issue- repeatedly right-clicking on the system tray icon to activate the context menu will eventually cause a general protection fault (GPF). 😦

So I can either try to handle menu changes properly, and as a result lose access to the system tray icon entirely -OR- I can forgo the events and just modify the menu whenever the hell I feel like it, knowing that it will eventually cause the app to crash.