beautypg.com

Dreamweaver.flash.evalscript() – Adobe Dreamweaver API Reference CS5 User Manual

Page 52

background image

47

DREAMWEAVER API REFERENCE

Flash integration

Last updated 8/27/2013

Example
The following example is used for setting up the menu:

function initializeMenuItem(menuID, menuName,extensionID, submenu)
{

var menuItem = {};
menuItem.menuId = menuID; //!< unique menu ID, if NULL menu is disabled
menuItem.nameUtf8 = menuName; //!< Item title, if "---" item is a separator
menuItem.extensionId = extensionID; //!< optional extension ID, used for panels only
menuItem.submenu = submenu; //!< if non-NULL, this is a submenu
return menuItem;

}
function setupMenu()
{

var menuItems = new Array();
menuItems.push(initializeMenuItem('id1','Call .swf

ActionScript',undefined,undefined));

menuItems.push(initializeMenuItem('id0','---',undefined,undefined));
menuItems.push(initializeMenuItem('id2','Call Dw JavaScript',undefined,undefined));
dw.flash.setMenu('Flickr',controlID,menuItems);

}

Note: Specify a function named "

onSelectMenuItem

" in the JavaScript file specified in the

scriptPath

in the object

passed to newControl.

The

onSelectMenuItem

is a menu Item Handler. It gets called with the corresponding menu ID when a command is

selected from the Floater's Fly Out menu.

The following example specifies the Callback handler definition in 'Configuration/flash/Flickr.js':

function onSelectMenuItem(menuID)
{

if (menuID == 'id1') {

var flashCallbackString = 'returntype="xml">
Hello
';
dw.flash.control Event('Flickr', flashCallbackString);
return("PlugPlugRequestCompleted");

} else {

alert ( ' You selected: menuID = ' + menuID);
return ( " PlugPlugRequestCompleted");
}

}

dreamweaver.flash.evalScript()

Availability
Dreamweaver CS4.

Description
This function is used to call a JavaScript function for one of the following purposes:

To execute a JavaScript function defined in the script file associated with the extension (for CSXS extensions).

The .js file defined in the

scriptPath

parameter for non-CSXS based Extensions.