Specifying menu item mnemonics

Adobe AIR 1.0 and later

A menu item mnemonic is a key associated with a menu item. When the key is pressed while the menu is displayed, the menu item command is triggered. The behavior is the same as if the user had selected the menu item with the mouse. Typically the operating system indicates a menu item mnemonic by underlining that character in the name of the menu item.

For more information about mnemonics, see Mnemonics (AIR) .

With the MenuBuilder framework, the simplest way to specify a mnemonic for a menu item is to include an underscore character (“ _ ”) in the menu item’s label field. Place the underscore immediately to the left of the letter that serves as the mnemonic for that menu item. For example, if the following XML node is used in a data source that’s loaded using the MenuBuilder framework, the mnemonic for the command is the first character of the second word (the letter “A”):

<menuitem label="Save _As"/>

When the NativeMenu object is created, the underscore is not included in the label. Instead, the character following the underscore becomes the mnemonic for the menu item. To include a literal underscore character in a menu item’s name, use two underscore characters (“ __ ”). This sequence is converted to an underscore in the menu item label.

As an alternative to using an underscore character in the label field, you can provide an integer index position for the mnemonic character. Specify the index in the mnemonicIndex field in the menu item data source object or XML element.

// Ethnio survey code removed