SWFobject嵌入式swf,ExternalInterface.Call返回null

时间:2012-04-09 07:28:48

标签: django flash

我正在使用dfango后端使用swfobject将swf嵌入到视图中进行Flash游戏, 但是当我在InternetExplorer中使用flash中的externalinterface.call()时(Chrome和Firefox很好),它会返回null

Flash游戏本身运作完美

Django查看和嵌入代码:

<div id="game_container">
    <div id='flashContent'></div>
    </div>
    <script type="text/javascript" src="swfobject.js"></script>
    <script type='text/javascript'> 
    var flashvars={{flashvars|safe}};
    var params={wmode:"opaque", allowscriptaccess:"always" };
    var attributes={id:"flashContent", name:"flashContent"};
    swfobject.embedSWF("{{SWF_URL}}", "flashContent", "{{ appsettings.SWF_WIDTH }}", "{{ appsettings.SWF_HEIGHT }}", "10.0.0", false, flashvars, params, attributes);
</script>


function fqlearn_isEventInteresting(data) {
ln_log(['isEventInteresting',data]);
if (!BASE_URL) BASE_URL = data.baseURL;
ln_log(['got lesson?',fqlearn_findLearningModule(data) != null]);
return fqlearn_findLearningModule(data) != null;
//shuld return either true or false.
}

Flash AS3代码:

var isInteresting:Object = false;

        try {
            isInteresting = ExternalInterface.call('fqlearn_isEventInteresting', data);
        } catch (e:Error) {
            trace("error calling external interface");
            // Container does not support outgoing calls :/
            rpc.forceLogUncaughtError("ExternalInterface.call problem",
                e.name, e.toString(), e.getStackTrace());
            rest.apply(restThis);
            return;
        } catch (e:SecurityError) {
            // Security sandbox nonsense :/
            throw e;
        }

        if (isInteresting == null) {
            // Something went wrong :/
            rpc.forceLogUncaughtError("ExternalInterface.call problem", "JS_returned_null_error");
        }

        if (isInteresting) {
            trace("showing learning blackout")
            dispatch(CoordinationEvent.newLEARNING_ABOUT_TO_SHOW());

            learningPendingData = {
                rest: rest,
                restThis: restThis
            };
来自InternetExplorer中的Flash的 ExternalInterface.call()(Chrome和Firefox很好),它返回null。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

修正了它:console.debug窒息了Internet Explorer。我删除了它们并且有效。