Oh the error message is:
TypeError: Can't get property CLICK from undefined value
This is even from air.MouseEvent.CLICK
Try something like the below:
wow putting the event in quotes was the only thing i did not try or find on the forums. i had found a guy who said that all he needed to do was use click, but i thought he meant as an object. so i put "click" instead of "mouseDown" and it works all the same. i wish that was in the docs somewhere that for the tray you use strings instead of objects
Now what about that "air." prefix, you ask? Well to make things a bit easier, so you don't have to type long strings for every AIR object reference, the AIR SDK includes the AIRAliases.js file. This file includes aliases, or shortcuts for many (but not all) of the built-in AIR classes. For example, you can use air.NativeApplication.nativeApplication because of this line in the file:
air.NativeApplication = window.runtime.flash.desktop.NativeApplication;
To use these shortcuts, you must include the AIRAliases.js file in your HTML page using a script tag.
Mouse event constants for click, mouseDown, etc, are defined in the MouseEvent class. The relevant line in the aliases file is:
air.MouseEvent = window.runtime.flash.events.MouseEvent;
So the way to use the mouse event type constants is the following:
BTW, the convention for the string values of the event type names is that the string is the camel case version of the constant name (without underscores). Thus MouseEvent.MOUSE_DOWN == "mouseDown".
What does your restore app function look like? I'd like to use it but I have tried using
window.nativeWindow.maximize(); but then my app just break since i use custom chrome.
I just created something similar and successfully used NativeWindow.activate and NativeApplication.activate to restore the main app. Note that you cannot re-open closed windows, and if Mac, the Dock icon will not dispatch a CLICK event. Instead for the Dock listen for the NativeApplication INVOKE event. You may also need to investigate the use of NativeApplication.autoExit.