Defining Menu Items - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
The name attribute specifies the name used to access the menu in the JavaScript namespace, while the
title attribute specifies the text that appears as the menu's title in the GoLive menu bar.
In this example, this defines the top level of the menu:
You use the name, rather than the title, to access the menu when this extension is running:
If you omit the name property or supply no value for it, GoLive uses the value of the title property as the
default value of name . To retrieve the menu reliably, the name must be unique in the JavaScript
namespace.
Unlike most of the objects in an extension, menus are a resource shared by all extension modules. The
menus global array makes all menus defined by all extensions available to all extensions. If a <jsxmenu>
element's name attribute duplicates the name property of an existing menu object defined by any module
the SDK has already loaded, GoLive appends the element's menu items to that existing menu.

Defining menu items

The <jsxmenu></jsxmenu> tags that define a custom menu enclose one or more <jsxitem> tags. Each
<jsxitem> tag defines a menu item that appears in the custom menu. The syntax for this tag is:
<jsxitem name="
As for the menu itself, the name attribute specifies the name used to access the menu item in the
JavaScript namespace, while the title attribute specifies the text that appears in the menu in the GoLive
UI.
The optional dynamic attribute specifies that this item needs to be initialized on startup. For details, see
Initializing menu
In the example, this defines the two custom menu items.
// Main.html file for Hello example
<html>
<body>
<!-- The Hello GoLive Menu ------------------->
</body>
// Main.html file for Hello example
<html>
<body>
<!-- The Hello GoLive Menu ------------------->
<jsxmenubar> // opens definition of all menus and menu items
<jsxmenu name="Hello" title="Hello, GoLive!">
// Tags that define your menu items will go here.
</jsxmenu>
</jsxmenubar> // closes definition of all menus & menu items
</body>
</html>
myMenu = menubar["Hello"];
name
" title="
items.
<jsxmenubar> // opens definition of all menus and menu items
<jsxmenu name="Hello" title="Hello, GoLive!">
<jsxitem name="doThis" title="Do Something">
<jsxitem name="doThat" title="Do Something Else">
</jsxmenu>
</jsxmenubar> // closes definition of all menus & menu items
Adobe GoLive CS2 SDK
Item text
" [dynamic]>
Menus and Toolbars
42

Advertisement

Table of Contents
loading

Table of Contents