Adobe GoLive CS2 Programmer's Manual page 49

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
To add your own menu items to an existing menu, place your <jsxitem> tags inside a <jsxmenu>
element whose name attribute has that menu's name. Your script can access all existing menus by name
from the global app.menubar array. The names of predefined menus are:
file
edit
type
special
view
window
help
site
diagram
movie
Menu items that you add can be appended to the bottom of the menu, or placed with respect to existing
items. When GoLive appends multiple custom items to a menu, their order in the menu reflects the order
in which GoLive loaded the modules that define the menu items, as well as the order in which each
extension's Main.html file defines them when read from top to bottom. You cannot control the order in
which GoLive loads modules, but each extension's menu items always appear in the order that the
Main.html file defines them.
This example adds items to the Special menu:
<jsxmodule name="DynamicMenus">
<jsxmenubar>
<jsxmenu name="special">
</jsxmenu>
</jsxmenubar>
<script>
initializeModule() {
}
function menuSetupHandler( evObj ) {
}
function menuClicked( evObj ) {
}
</script>
When the module containing this code is loaded, you see the menu items Special One, Special Two, and
Special Three at the end of the Special menu.
You can place items in an existing submenu by specifying the location and the submenu's JavaScript
name. For example, this adds an item to the end of the Templates submenu in the Special menu:
<jsxmenubar>
<jsxmenu name="TMPL">
<jsxitem name="one" title="Special One" location="end" dynamic>
<jsxitem name="two" title="Special Two" location="end">
<jsxitem name="three" title="Special Three"location="end">
app.addEventListener( "menuSetup", menuSetupHandler );
app.addEventListener( "menuSignal", menuClicked );
if (evObj.target.name == "one" )
item.checked = !item.checked;
if (evObj..target.name == "one")
alert ("Selected: " + item.title);
<jsxitem name="myTemplate" title="My Template"
Adobe GoLive CS2 SDK
Menus and Toolbars
49

Advertisement

Table of Contents
loading

Table of Contents