Flash和Js接口交互 - samao/bilibili GitHub Wiki
Flash调Js接口
- Js代码
function onFlashCall(value)
{
console.log("flash say hello");
}
- Flash代码
ExternalInterface.call("onFlashCall","hello world!");
Js调Flash接口
- Js代码
function getSWF()
{
if(navigator.appName.indexOf("Microsoft")!=-1)
{
return window["AcNewPlayer"];
}else{
return document.getElementById("AcNewPlayer");
}
}
getSWF().sayHello(""hello world);
- Flash代码
function jsCall(value:String):void
{
trace("JS say:",value);
}
ExternalInterface.addCallBack("sayHello",jsCall);