Implementing The Undosignal Function - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
undo.box = box.name;
undo.oldSrc = box.element.src;
undo.newSrc = box.link.url;
// this causes undoSignal() to be called
undo.submit();
}
// register handler with urlgetter control
function initializeModule() {
var urlgetter = controls[mycontrolname];
urlgetter.addEventListener( 'onChange', urlChanged);
}
An undo object property can only store the path to a JavaScript object —it does not store the actual
object or maintain a JavaScript object reference to it. If you need to ensure that an object will be available
to the undo object, you must save it in a global variable outside of the undo object or the function that
creates the undo object. This includes native JavaScript objects such as String, Date, or Number objects, as
well as objects you create using JavaScript.
If your extension implements more than one command that can be undone, you must create a property
that you can use to specify the command that is to be undone. In this example, the kind property serves
that purpose:
undo.kind = "Link";
You may also need to store values you can use to retrieve objects later, such as their unique name
properties.
undo.boxName = box.name;
As soon as you submit the undo object, GoLive makes it available to the user in the History palette. If
necessary, however, you can still add properties to an undo object even after it has been submitted.

Implementing the undoSignal Function

When you call the submit method, and thereafter when the user issues the command to undo or redo a
task, GoLive generates an
the undo and redo functionality.
The
undoEvent
indicates whether your method should do the operation for the first time, undo the operation, or redo the
operation:
0
1
2
Your handler can provide undo and redo code for any number of operations. To determine which
operation to perform, use the kind property (or its equivalent) that you added to the undo object when
you created it. Use a switch statement to customize the actions of the undoSignal function according
to the particular undo object GoLive passes to it.
For example:
function myUndoHandler (undoEvt) {
undoSignal
object passed to the handler contains the
Do
Undo object's
Undo
User issued the Undo command. Undo the operation.
Redo
User issued the Redo command. Reverse the effects of the Undo operation.
Adobe GoLive CS2 SDK
in the
module
Object. Your handler for this event must implement
method was called. Do the operation for the first time.
submit
undo Object
and an action code. The code
Custom Elements
90

Advertisement

Table of Contents
loading

Table of Contents