I'm trying to create a swfPanel for Flash CS5.5 using JSFL. I created my interface in flash and try to communicate with a JSFL command. So, in my .fla file, I use an ExternalInterface with callBack to call a specific function in JSFL, and then swfPanel.call() for the return. The problem I encounter is that I can't pass an Array as argument for the call function (after the AS3 function name). Here's the code :
In AS3 :
function init():void{
ExternalInterface.addCallback("callBackPanel", JsflCallback);
MMExecute("fl.runScript( fl.configURI + \"AirMobileFramework/AirMobileFrameworkPanel.jsfl\", \"checkSettings\" );");
}
function JsflCallback(... args):void{
jsTrace("callback");
}
function jsTrace(str:String):void{
MMExecute("fl.trace(\"" + str + "\");");
}
In JSFL :
function checkSettings(){
var fileSettingsUrl = fl.configURI + "AirMobileFramework/settings.fwk";
var exist = FLfile.exists(fileSettingsUrl);
var result = new Array("settings", exist);
if(!exist){
FLfile.write(fileSettingsUrl, "");
} else {
result.push(FLfile.read(fileSettingsUrl));
}
callPanelBack(result);
}
function callPanelBack(result){
fl.trace("result: " + result.length + " > " + typeof result + " >> " + result[0]);
var panel;
if(fl.swfPanels.length > 0){
for(x = 0; x < fl.swfPanels.length; x++){
if(fl.swfPanels[x].name == "AirMobileFramework"){
panel = fl.swfPanels[x];
panel.call("callBackPanel", result);
break;
}
}
} else {
fl.trace("No existing panel");
}
}
When calling panel.call("callBackPanel", result[0], result[1]); there is no problem, my callback is well called, but when using panel.call("callBackPanel", result); I've an error : La ou les erreurs JavaScript suivantes se sont produites lors de l'exécution de AirMobileFramework : La ou les erreur(s) JavaScript suivantes se sont produites :
Any idea ??