Adobe GoLive CS2 Programmer's Manual page 75

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
handler that is registered with the target object itself. After executing the target handler, it "bubbles" back
out through the ancestor objects, running the first registered handler that it finds on the way out.
This allows you to execute multiple handlers for the same event occurrence, or to handle events at a
higher level. For example, you could register an
the dialog in the figure on
controls. A handler registered at the parent level would use a switch or other conditional construct to
determine which individual control was the actual target of the event. The parent object where this
handler was registered is passed in the event object's currentTarget property.
When you register a handler with a parent or ancestor of the actual target object, you must specify the
third argument, capture , to be true :
function initializeModule() {
dialogs['burgerDialog'].addEventListener( 'onClick',
Typically, you register handlers at the application level, and determine the target object in the handler
function. For example, the following handler, registered with the application, prints out which control was
clicked:
// register handler with application
function initializeModule()
{
// Any control clicked
app.addEventListener( 'onClick', ctrlClickHandler,
}
// define handler
function ctrlClickHandler( eventObj )
{
switch ( eventObj.target.name )
{
// Source dialog
page
67, instead of or in addition to handlers registered with the individual
handleControlClicks, true);
true);
case 'lettuceBox':
writeln( "lettuce checkBox" );
break;
case 'tomatoBox':
writeln( "Tomato checkBox" );
break;
case 'rawRadio':
writeln( "Raw Radio" );
break;
case 'medRadio':
writeln( "Pinkish Radio" );
break;
case 'breadMenu':
writeln( "List value selected: " + eventObj.target.value );
break;
case 'myColor':
writeln( "Color: " + eventObj.target.value);
break;
case 'checkLinNumbers':
writeln( "Line numbers: " + eventObj.target.value);
break;
case 'srcArea':
Adobe GoLive CS2 SDK
onClick
event handler with the dialog window object for
Windows and Controls
75

Advertisement

Table of Contents
loading

Table of Contents