ssCommand

ssCommand is a _global method that is used to execute SWF Studio commands from Flash ActionScript. It is a helper method for use when the ActionScript API is not included. While ssCommand is available even when the ActionScript API is included, it is recommended to use the ActionScript API rather than ssCommand because of the ActionScript API's callback abilities. With ssCommand you are responsible for checking the variables you specify that will be populated with data from SWF Studio (called Out Parameters).


Usage

ssCommand(commandString,conditionCodeString,parametersObject)


Parameters

command - String - The command to execute. See the Plugins and ssCore sections for listings of available commands.

conditionCode - String - The name of a variable that will receive a code indicating whether the command completed successfully or not.

parameters - Object - An object containing properties that correspond to the input and output parameters of the command specified in the commandString.


Examples

Example 1

This example minimizes the window. There are no parameters for this command and the condition code isn't required.

ssCommand("Win.minimize","",{});

Example 2

The following example displays a message box with the specified text. The value of the button pressed is returned to the result variable. We setup a function that is called when the condition code variable is set. See Macromedia Flash's documentation on watch for more information on this method. The value is displayed in a textfield if the condition code is zero. Any other values indicates an error.

function response(prop,oldval,newval)
{
    if (newval == '0')
    {
        textfield_txt.text = "You pressed "+_level0.mbResult;
    }
    else
    {
        textfield_txt.text = "An error occurred";
    }
}

_level0.watch("cc",response);

ssCommand("App.showMsgBox","_level0.cc",{prompt:"Do you like green eggs and ham?",result:"_level0.mbResult"});