1

打电话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;
    }
4

1 回答 1

0

不,如果您打算让页面通过相同的 js 函数调用再次访问 swf,请不要删除它。如果它不存在,您的外部 javascript 调用将不起作用。

你为什么担心删除它?

于 2012-12-10T13:49:15.007 回答