Sending Messages To Other Extension Modules; Responding To A Broadcast; Delays And Timeouts - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide

Sending messages to other extension modules

The broadcast method sends its argument to the broadcastSignal method of any or all running
extension modules.
broadcast(
This method converts the argument value to a string, stores the name of the calling module and the
argument string to a broadcastEvent object, and generates this event in the target module or modules.
The optional targets value is a list of modules to call, in calling order. By default, the broadcast method
generates the event in every extension module.
Each called module's registered broadcastEvent handler must return a string value or undefined .
Broadcasting terminates as soon as any extension's handler returns a value. (The handler can also store a
response in the answer property of the event object.)
This method's result is the return value supplied by the last handler. If none of the called modules supply a
return value, the broadcast method's return value is undefined .

Responding to a broadcast

To receive and respond to messages from other extensions, your extension must define a handler for the
broadcast
according to the message and sender values in the passed
sets in the object's answer property is returned as the broadcast method's return value. For example:
function handleBroadcast(bcastEvt) {
switch (bcastEvt.message)
{
}
}
//register handler
function initializeModule(){
app.addEventListener( 'broadcastSignal', handleBroadcast)
}

Delays and Timeouts

GoLive has a global timer that you can use to schedule execution of your own scriptlets.
You can set a JavaScript timeout value to avoid an infinite loop or other failure in an extension's
JavaScript code that could otherwise halt GoLive indefinitely.
argument
targets
[,
event and register it with the app object. A called module's handler determines its actions
case thisValue:
bcastEvt.answer=5;
case thatValue:
bcastEvt.answer="Yes";
case anotherValue: {
var myResult = myFunction();
if (myResult)
bcastEvt.answer=myResult.toString()
else
bcastEvt.answer="undefined";
}
default:
bcastEvt.answer="undefined";
Adobe GoLive CS2 SDK
]);
The JavaScript Environment
broadcastEvent
object. The value the handler
36

Advertisement

Table of Contents
loading

Table of Contents