If you want to add just a single (or more) custom NativeMenuItem on the your existing NativeMenu, you can do it without recreate all the NativeMenu structure.
Just write down something like:
// get the NativeMenu object
var nm:NativeMenu = NativeApplication.nativeApplication.menu
// I want to use the first menuItem, so use the index=0
var nm0:NativeMenuItem = nm.getItemAt(0)
// create the custom NativeMenuItem
var prefMenu:NativeMenuItem = new NativeMenuItem("Preferences...");
prefMenu.addEventListener(Event.SELECT, openPrefWin);
var separator:NativeMenuItem = new NativeMenuItem("separator", true);
// add it to our existing NativeMenu
// these menu will placed immediately after the 'About' menuItem
nm0.submenu.addItemAt(separator, 1)
nm0.submenu.addItemAt(prefMenu, 2)
That’s it
thank you! you’ve relieved my headache.
this process is very unclear. instead of rerouting thru the submenu property it would be more clear if adobe supplied a getSubmenu and getSubmenuAt methods in the NativeMenu class.
thanks again!