我知道ExternalInterface.call('functionName', arguments);
在 ActionScript 3 中可用于与function functionName(arguments)
HTML 页面上定义的 Javascript 进行通信。
但是自定义对象实例呢?说我有:
(function (factory, $, undefined) {
factory.worker = function () {
...
};
factory.worker.prototype.init = function (params) {
...
};
factory.worker.prototype.flash_tell_me_something = function (params) {
...
};
}(window.factory = window.factory || {}, jQuery));
为了使用它,我将它与 jQuery 结合起来创建一个实例,加上 Flash 对象:
$(document).ready(function () {
var myworker = new factory.worker();
myworker.init();
var myloadedcallback = function () {
};
flashVars = {loadedCallback: myloadedcallback};
...
swfobject.embedSWF(swfUrl, id, 215, 138, version, null, flashVars, params);
});
如何myworker.flash_tell_me_something(...)
从 Flash 呼叫?