ssCore.ActiveX.setNotify

Tell SWF Studio about an ActiveX event that you want to receive notifications for.


Availability:

First available in version 3.3 build 120.


Input Parameters:

object - The name of the ActiveX object used in the call to createObject.

event - The event you want to receive notifications for. Valid values include: (see notes).


Output Parameters:

result - Notification data for the specified event (see notes for implementation details).


Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.ActiveX.setNotify( paramsObject [, callbackParamsObject] [, errorParamsObject] );


Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.ActiveX.setNotify( paramsObject );


Notes:

The setNotify method for ActiveX objects works almost exactly like setNotify methods on other SWF Studio objects with two slight differences.

The first is that the event parameter doesn't have a list of events that you can use. That's because the list of events depends on the ActiveX control you have created. You'll need to locate the events you want to receieve notifications for using the ActiveX Info tool. Whatever events you see listed there can also be used with ssEvents.

Once you've found the event(s) you want, the other difference you need to know about is how the data is presented to the callback function. In all other notification handlers the return objects result member contains a comma delimited list of values. ActiveX notification functions still receive their data via the return objects result member, but the data is formatted a bit differently to give you more flexibility when dealing with ActiveX events.

Here's a simple example of how to create an instance of the Microsoft Web Browser control (it has a progId of "Shell.Explorer"). In this example we want to receive a notification every time the browser has navigated to a new page.

ssCore.init();
ssDefaults.synchronousCommands = true;

ssCore.ActiveX.createObject({object:'browser1', progId:'Shell.Explorer'});

ssCore.browser1.setNotify({event:"NavigateComplete2"}, {callback:onNavigateComplete2});

ssCore.browser1.setPosition({x:0, y:0});
ssCore.browser1.setSize({width:Stage.width, height:Stage.height});
ssCore.browser1.Navigate2({URL:"http://www.northcode.com"});
ssCore.browser1.setVisible({visible:true});

function onNavigateComplete2(ret_obj, cb_obj, err_obj)
{
    var pairs = ret_obj.result.split("\r");

    for (i=0; i<pairs.length; i++)
    {
        temp = pairs[i].split(":");
        name = temp[0];
        value = temp[1];
        ssDebug.trace(name + " = " + value);
    }

         ssDebug.trace("");
}

The event we want is the NavigateComplete2 and in the ActiveX Info tool it appears like this:

NavigateComplete2(pDisp, URL)

When the event is called the parameters shown above (pDisp and URL) will be passed to our notification handler along with the name of the object that generated the event and the name of the event itself. The data is presented in name:value pair format where each pair is separated by a carriage return (\r). The onNavigateComplete2 function above shows how to break up this data so you can access the individual parameters.

object = browser1
event = NavigateComplete2
pDisp = Microsoft Web Browser Control
URL = http

This extra information is provided in case you want to set up one notification handler to deal with multiple events, or events from different controls. If you enable debug mode in SWF Studio and run the example above, the following appears in the Trace Output window on the Trace Tab. Each time you click on a link that takes you to a new page, another block of data like this will appear in the Trace Output window.


Examples:

ssCore.ActiveX.setNotify({object:"MyBrowser", event:"DocumentComplete"});