ffish_new Creating an instance of a FFish script object. The first parameter is the name of the FFish script object, the other parameters are passed to the constructor of the FFish script object. E.g.
var identifier = ExternalInterface.call("ffish_new", "ActiveXObject",
"ShockwaveFlash.ShockwaveFlash");
This function will returns an identifier of the newly created FFish script object that
can be used to access its properties and methods.
ffish_delete Deleting a FFish script object
ExternalInterface.call("ffish_delete", identifier);
ffish_call Calling a method of a FFish script. The first parameter is the identifier of the FFish script object, or the name of the object if the method is static, the second parameter is the name of the method, and the other parameters are passed to the method of the object. If the method accepts an FFish script object as a parameter, you must also use an identifier of the object.
var devices = ExternalInterface.call("ffish_call", "MCI", "getDevices");
ffish_call2 Similar to ffish_call. The third parameter of this method is an array that contains all parameters that will be passed to the method of the FFish script to call.
ffish_getprop Get the value of a property of a FFish script object. The first parameter is the identifer of the object, or the name of the object if the property is static.
var command = ExternalInterface.call("ffish_getprop", identifier, "command");
ffish_setprop Set the value of a property of a FFish script object. The first parameter is the identifer of the object, or the name of the object if the property is static. The second parameter is the value to set to the property of the object.
ExternalInterface.call("ffish_setprop", identifier, "command", "open");
ffish_run, ffish_eval The ffish_run method is used to call a FFish script, and the ffish_eval method is used to execute FFish script code. These two methods are almost the same as the ffish_run and ffish_eval fscommands. The only difference is that these two methods will call the scripts or code synchronously, whereas the fscommands are asynchronous.
fscommand("ffish_run", "newplayer");
function _swfkitcmd(name, args)
{
ExternalInterface.call(name, args);
}
_swfkitcmd("ffish_run", "newplayer");
exec Similar to the exec fscommand. The only difference between this method and the exec fscommand is that this method is synchronous. Both this method and the exe fscommand can launch any external applications.
Besides the above methods, the ExternalInterface.call method can also be used to call global methods defined in FFish script. For example, you can write a function in the "initialize" script in SWFkit and call it in Action script synchronously. For example, in SWFKit:
// save a XML file
function saveXML(fileName, xml)
{
var f = new File(fileName, "w");
f.write(xml);
f.close();
}
In Action script
var xml = new XML;
...
ExternalInterface.call("saveXML", "c:\\test.xml", xml.toString();
Using the above methods to call FFish script is not so convenient, so we wrapped most of the FFish script objects in action script classes and you can call them in action script using almost the same syntax as in ffish script. For example, the Form object:
import flash.external.*;
class SWFKit.Form extends SWFKit.BaseObj
{
public function Form()
{
super("Form");
}
public static function fromID(id: Number)
{
var form = new Form;
form.Release();
form.Identifier = id;
}
public function get movie()
{
return ExternalInterface.call("ffish_getprop", this.Identifier, "movie");
}
public function set movie(value: String)
{
ExternalInterface.call("ffish_setprop", this.Identifier, "movie", value);
}
public function get showCaption()
{
return ExternalInterface.call("ffish_getprop", this.Identifier, "showCaption");
}
public function set showCaption(value: Boolean)
{
ExternalInterface.call("ffish_setprop", this.Identifier, "showCaption", value);
}
public function get canDrag()
{
return ExternalInterface.call("ffish_getprop", this.Identifier, "canDrag");
}
public function set canDrag(value: Boolean)
{
ExternalInterface.call("ffish_setprop", this.Identifier, "canDrag", value);
}
public function get clipRegion()
{
return ExternalInterface.call("ffish_getprop", this.Identifier, "clipRegion");
}
public function set clipRegion(value: String)
{
ExternalInterface.call("ffish_setprop", this.Identifier, "clipRegion", value);
}
public function get caption()
{
return ExternalInterface.call("ffish_getprop", this.Identifier, "caption");
}
public function set caption(value: String)
{
ExternalInterface.call("ffish_setprop", this.Identifier, "caption", value);
}
public function get initVars()
{
return ExternalInterface.call("ffish_getprop", this.Identifier, "initVars");
}
public function set initVars(value: String)
{
ExternalInterface.call("ffish_setprop", this.Identifier, "initVars", value);
}
public function get window()
{
var win = ExternalInterface.call("ffish_getprop", this.Identifier, "window");
if (win == null || win == undefined) return null;
return new SWFKit.Window(win);
}
public function show()
{
return ExternalInterface.call("ffish_call2", this.Identifier,
"show", arguments);
}
public function close(value)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"close", value);
}
public function getVariable(variable)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"getVariable", variable);
}
public function setVariable(variable, value)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"setVariable", variable, value);
}
public function targetGotoFrame(target, frame)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"targetGotoFrame", target, frame);
}
public function targetGotoLabel(target, label)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"targetGotoLabel", target, label);
}
public function targetCallFrame(target, frame)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"targetCallFrame", target, frame);
}
public function targetCallLabel(target, label)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"targetCallLabel", target, label);
}
public function setBase(path)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"setBase", path);
}
public function loadMovie(layer, movie)
{
return ExternalInterface.call("ffish_call", this.Identifier,
"loadMovie", layer, movie);
}
public function createControl()
{
var axc = ExternalInterface.call("ffish_call2", this.Identifier,
"createControl", arguments);
if (axc == null) return null;
return new SWFKit.AXControl(axc);
}
}
So you can create a form in action script in the same way as in ffish script
import SWFKit.*;
var form = new Form;
form.movie = Global.getAdditionalFile("forform.swf");
form.caption = "hello";
form.showCaption = true;
form.canDrag = true;
form.show(true);