import flash.external.*;
class SWFKit.ActiveXObject extends SWFKit.BaseObj
{
public function ActiveXObject(progID)
{
if (progID == null)
{
this.Identifier = 0;
}
else
{
var ret = ExternalInterface.call("ffish_new", "ActiveXObject", progID);
if (ret == null || ret == undefined) this.Identifier = 0;
else this.Identifier = ret;
}
}
public static function fromID(id: Number)
{
var ax = new ActiveXObject(null);
ax.Identifier = id;
return ax;
}
public static function register(filename: String)
{
return ExternalInterface.call("ffish_call", "ActiveXObject", "register");
}
public static function unregister(filename: String)
{
return ExternalInterface.call("ffish_call", "ActiveXObject", "unregister");
}
public function getProperty(prop: String)
{
return ExternalInterface.call("ffish_getprop", this.Identifier, prop);
}
public function setProperty(prop: String, value)
{
ExternalInterface.call("ffish_setprop", this.Identifier, prop, value);
}
public function callMethod()
{
var args = arguments;
if (args.length >= 1)
{
var argForFFish = new Array();
var i;
for (i = 1; i < args.length; i++)
argForFFish.push(args[i]);
return ExternalInterface.call("ffish_call2", this.Identifier,
args[0], argForFFish);
}
return undefined;
}
}
To wrap an ActiveX component, you would have to inherit this class. For example, wrapping a method of the Flash Player activex control.
import flash.external.*;
import SWFKit.*;
class FPActiveX extends SWFKit.ActiveXObject
{
public function FPActiveX(progID)
{
super(progID);
}
public function FlashVersion()
{
return ExternalInterface.call("ffish_call", this.Identifier,
"FlashVersion");
}
}
To call it
var fp = new FPActiveX("ShockwaveFlash.ShockwaveFlash");
_root.strace(fp.FlashVersion());