A method for executing an pre-assigned function in ActionScript from JScript.


First available in version 3.5.

Available only in ActionScript 3.


returnValue = jsScript.execute(arg0 ... argN)

returnValue - * - Data is returned immediately to this object. The data type is not predefined in JScript. The data type of the value will be of the type passed by the return of the function in ActionScript, as long as it is a data type that is supported by JSON.


arg0 ... argN - Any number of parameters, of almost any data type can be passed. For more information about supported data types see the JSON web site.


See ssScript.addCallHandler for more information about setting up a handler function in ActionScript.


Example 1:
In the following example we pass values to the pre-defined ActionScript handler function, which passes some values back, and which we'll display in the SWF Studio Trace tab.

var answer = jsScript.execute("The ActionScript function will double the value we send...", 12);

trace("The returned value: "+answer);

Here is the ActionScript handler function.

function myModuleCallHandler(myStr:String, aNum:Number):void

    return aNum * 2;