Overview

SWF Studio contains an ActionScript Application Program Interface (API) which is implemented as a highly organized collection of Flash objects that are used to execute commands and communicate with the SWF Studio runtime.

ssCore provides access to all of the core SWF Studio commands and plugins.

ssDebug allows you to generate and control the display of debug information in your SWF Studio applications.

ssDefaults contains properties that allow you to control the runtime behavior of the ActionScript API.

ssEvents simplifies the use of the setNotify commands (used to set up event notification handlers) and provides a model that is similar to using Flash events.

ssGlobals containings a set static and dynamic global variables populated by SWF Studio. These variables provide convenient access to information about the SWF Studio runtime environment, the operating system and hardware.

ssKey is a set of properties that represent all of the key code values that can be generated by Windows.

ssMovieClipLoader is an enhanced version of the Flash MX 2004 MovieClipLoader class that implements some SWF Studio specific functionality and can also be used by Flash MX developers. This object is not available in ActionScript 3.

ssSecure allows files to be loaded securely, directly from the internal SWF Studio resources. This object is not available in ActionScript 3.

ssURLLoader allows files to be loaded securely, directly from the internal SWF Studio resources. This object is only available in ActionScript 3.

ssScript allows communication between a JScript module and ActionScript. This object is only available in ActionScript 3.


You can use the synchronousCommands property of the ssDefaults object to tell SWF Studio whether ssCore commands should be executed synchronously or asynchronously.

You can use the sync property of the callback parameters object to override the global ssDefaults.synchronousCommands setting and make the synchronous vs. asynchronous distinction for each individual command.

By default, SWF Studio uses the asynchronous call method, which requires the use of a callback function to receive the results of the command.

ssCore.Win.getPosition({}, {callback:onComplete});

function onComplete(return_obj, callback_obj, error_obj)
{
    ssCore.App.showMsgBox({prompt:return_obj.x + "," + return_obj.y});
}

If you wanted to convert the Win.getPosition call to synchronous mode, the only required change is that in the callback object you specify sync:true instead of a callback function.

var r = ssCore.Win.getPosition({}, {sync:true}); // synchronous
ssCore.App.showMsgBox({prompt:r.x + "," + r.y}); // still asynchronous

The return object (r) is the same object that would have been returned to the callback function so you can check r.success and access all the output variables as properties of the return object.

One thing to note here is that you can easily mix synchronous and asynchronous calls, giving you access to the best of both worlds.

Adding sync:true on every call that you want to be synchronous is not a very good general solution so Studio gives you another option, a global setting you can change to make all calls synchronous by default.

ssDefaults.synchronousCommands = true;
var r = ssCore.Win.getPosition({}); // synchronous
ssCore.App.showMsgBox({prompt:r.x + "," + r.y}); // synchronous

If you want to make use of asynchronous calls you can still use the sync flag on the callback object to override the global default setting.

ssDefaults.synchronousCommands = true;
var r = ssCore.Win.getPosition({}); // synchronous
ssCore.App.showMsgBox({prompt:r.x + "," + r.y}, {sync:false}); // asynchronous

If you provide a callback function for any command while ssDefaults.synchronousCommands = true, this has the same effect as setting sync to false... the command will operate asynchronously and the return object will be returned to the specified callback function.

ssDefaults.synchronousCommands = true;
ssCore.Win.getPosition({}, {callback:onComplete}); // asynchronous

function onComplete(return_obj, callback_obj, error_obj)
{
    ssCore.App.showMsgBox({prompt:return_obj.x + "," + return_obj.y}); // synchronous
}