我正在尝试从加载在应用程序选项卡中的SWF调用 JS 函数。作为画布 FBML,代码可以正常工作,但在应用程序选项卡的情况下它无法正常工作。
AS3 代码:
protected function button1_clickHandler(event:MouseEvent):void
{
callFBJS(["insideFlex"])
}
protected function callFBJS(text:Array):void
{
var connection:LocalConnection = new LocalConnection();
var connectionName:String = loaderInfo.parameters.fb_local_connection;
if (connectionName)
{
logLbl.text = "Connection Name: " + connectionName;
connection.send(connectionName,"callFBJS","doSomething",text);
logLbl.text = logLbl.text + "\n" + "Method invoked";
}
}
JS代码:
<fb:fbjs-bridge/>
<fb:swf swfsrc="<SWF File>" imgsrc="http://www.easyhealth.org.uk/cmsimages/adobe_flash_1470_1470.jpg" height="655" width="760"/>
<script>
function doSomething(a)
{
console.log(a);
}
</script>