ssSecure.addListener

Adds a listener object that will be notified of the events you specify with the event parameter.


Availability:

First available in version 3.0 build 2039.

Not available in ActionScript 3.


Input Parameters:

listener - Object - Object that will receive the notifications.

event - String - [Optional] - The event for which you want to receive notifications. Valid values include: onError.

callback - String - [Optional] - You can optionally specify the function that will receive the specified event. By default the event name is the function that will be called, but you can specify something else to avoid name collisions with functions you already have on the listener object, or to make the names more meaningful.


Output Parameters:

target - Object - A reference to the object that triggered the event.


Notes:

You can specify a listener object for which methods named after events will be called. The object specified as the listener should have a method named the same as the event for which you expect to receive notifications. Or you can specify the method to be called for a given event by specifying the callback parameter.


Examples:

Example 1:
In this example we create an instance of an object that will be our listener.

var myListener_obj = new Object;
myListener_obj.onError = function (event_obj)
{
    ssDebug.trace("ssSecure method failed:"+event_obj.description);
}
ssSecure.addListener({listener:myListener_obj,event:"onError"});

Example 2:
This example is functionally the same as the first example. However, here we have specified a different callback function.

var myListener_obj = new Object;
myListener_obj.errorHandler = function (event_obj)
{
    ssDebug.trace("ssSecure method failed:"+event_obj.description);
}
ssSecure.addListener({listener:myListener_obj,event:"onError",callback:"errorHandler"});