Updating Images Dynamically - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
switch (undoEvt.undo.kind) {
}
}
//register the handler with the module object
function initializeModule() {
var myModule = modules[mymodulename];
myModule.addEventListener( 'undoSignal',myUndoHandler);
}
Because each case in an undo handler must handle three cases of its own (Do, Undo, and Redo), you can
improve the readability of your code by creating helper functions to perform each task. In this example,
the undoLink function provides the data needed to change the url property of a custom box, undo the
change, and redo the change:
function undoLink (undo, action) {
// get the real box behind the name
var box = boxes[undo.boxName];
// undo
if (action == 1) {
// do or redo
else
}
}
In this simple example, the url property can hold only two possible values, so this function can treat the
and
Do
Redo
codes separately if necessary.
Note:
Do not call the reparse or reformat methods of the
action. Do not call the setInnerHTML or setOuterHTML methods of the
within an undo action if doing so would cause GoLive to reparse the document.

Updating Images Dynamically

GoLive uses the
use to represent a custom element in Layout view. When you use the <img> tag to define a static image in
your extension definition, the SDK creates a corresponding picture object. To create images for your
custom elements that you can update dynamically, create picture objects explicitly using the global
function
Images can be very large, so be sure to delete any unused picture objects.
case "Link":
undoLink (undoEvt.undo, undoEvt.action);
break;
// assume we've created these additional undo actions
case "TextColor":
undoTextColor (undoEvt.undo, undoEvt.action);
break;
case "What":
undoSomethingElse (undoEvt.undo, undoEvt.action);
break;
box.url = undo.oldURL; //get the saved URL
box.url = undo.newURL; //get the new URL
action codes exactly the same. Of course, your functions can handle the
picture Object
to represent images, such as those in the Objects palette, and those you
.
createPicture
Adobe GoLive CS2 SDK
document Object
from within an undo
markup Object
Custom Elements
91
and
action
Do
Redo
from

Advertisement

Table of Contents
loading

Table of Contents