I'm trying to call a JS function from an SWF which is loaded inside an application tab. As a canvas FBML, the code is working correctly but in case of application tab it's not working.
AS3 Code:
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 Code:
<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>