ZoomifyViewer.registerCallback(functionType,functionName)

Availability

Flash Player 6.

Usage

ZoomifyViewerInstance.registerCallback(functionType,functionName);

Parameters

functionType - the type of callback being registered.

functionName - the name of the function to be called passed in as a string.

Returns

Callback ID string

Description

Registers for a callback of a certain type. The name of the callback function to be called is passed in as a string. Callback values include:

"Init" - called when the image is done initializing. An image is initialized once it has downloaded its header information.

"DownloadComplete" - called when the download queue becomes empty. Useful after a call to updateView to determine when all tiles have been received.

"Mouse" - called on mouse down and mouse up in the viewer. The callback is called with 2 parameters. The first parameter is the instance pointer (this) and the second parameter: "start" on mouse down or "stop" on mouse up.

"Key" - called on key down and key up. The callback accepts 3 parameters. The first parameter is the instance pointer (this), the second is either "down" or "up" and the third is the keyCode of the pressed key. This callback is only triggered for keystrokes that the ZoomifyViewer responds to.

"Focus" - called whenever focus of this instance is set to true. This can happen through either a setFocus call or use interaction with the ZoomifyViewer instance.

"View" - called whenever the view changes. The view is reported as x,y, and zoom. See setView for a description of these parameters.

"Rect" - called whenever the view changes. In this case, the view is reported back as a bounding box in platform independent coordinates. This is useful for drawing a navigation window that shows where the user is currently looking.

"MaxZoomReached" - called when the max zoom is arrived at while zooming with key or zoomIn function.

"MinZoomReached" - called when the min zoom is arrived at while zooming with key or zoomIn function.

"Status" - called when the ZoomifyViewer engine report status.

Example


//Init callback example
var myCallbackID = _root.zoomifyViewerInstance.registerCallback("Init","ZoomifyViewerInitCallback");

function ZoomifyViewerInitCallback()
{
}

//View callback example
_root.zoomifyViewerInstance.registerCallback("View","ZoomifyViewCallback");
function ZoomifyViewCallback(focusInstance,x,y,zoom)
{
//Can be used to update a Nav Window
//See examples included with Zoomifyer for Flash for complete details
}

//Focus callback example
_root.zoomifyViewerInstance.registerCallback("Focus","ZoomifyFocusCallback");
function ZoomifyFocusCallback(focusInstance)
{
//Can be used to indicate which image is currently in focus
myTextBox.text=focusInstance._name;
}

//Status callback example
_root.zoomifyViewerInstance.registerCallback("Status","ZoomifyStatusCallback");
function ZoomifyStatusCallback(statusText)
{
//Can be used to add a status bar to the image
myTextBox.text=statusText;
}

See also

ZoomifyViewer.unregisterCallback
ZoomifyViewer.setFocus
ZoomifyViewer.setX
ZoomifyViewer.setY
ZoomifyViewer.setZoom
ZoomifyViewer.setView
ZoomifyViewer.resetView
ZoomifyViewer.zoomIn
ZoomifyViewer.zoomOut
ZoomifyViewer.panLeft
ZoomifyViewer.panRight
ZoomifyViewer.panUp
ZoomifyViewer.panDown
ZoomifyViewer.panStop