打电话ExternalInterface.addCallback
后,我需要吗
ExternalInterface.addCallback("foo", null);
因为我会使用ExternalInterface.call
很多次?
这是我的方法
public static function javascript(jsFunctionYouWantCall:String, jsFunctionToBindResponse:String, onResponse:Function, jsFunctionYouWantCallParam:Object = null):Boolean
{
if (!ExternalInterface.available)
return false;
try
{
ExternalInterface.addCallback(jsFunctionToBindResponse, function response(param:Object):void
{
//ExternalInterface.addCallback(jsFunctionToBindResponse, null);
onResponse(param);
});
ExternalInterface.call(jsFunctionYouWantCall, jsFunctionYouWantCallParam);
}
catch(error:Error)
{
onResponse(error);
}
return true;
}