包装函数ExternalInterface.call无法正常工作

时间:2015-11-11 19:33:11

标签: actionscript

当我执行包装器调用safeExternalCall("ToggleLoadingIcon", m_PlayerId, shouldShow);时,从不调用JavaScript函数ToggleLoadingIcon。但是,当我ExternalInterface.call("ToggleLoadingIcon", m_PlayerId, shouldShow);时,它会起作用。那是为什么?

的ActionScript:

private function showHideSpinner(shouldShow:Boolean):void
{
    //this does not work
    safeExternalCall("ToggleLoadingIcon", m_PlayerId, shouldShow);
    //but this works
    //ExternalInterface.call("ToggleLoadingIcon", m_PlayerId, shouldShow);
}

private function safeExternalCall(functionName:String, ... args):void
{
    try
    {
        if(ExternalInterface.call(functionName, args) == null)
        {
            //do some logging
        }
    }
    catch(error:Error)
    {
        //do some more logging
    }
}

1 个答案:

答案 0 :(得分:0)

有属性ExternalInterface.available,第一个线索是添加一些文本字段或连接调试器,看看它是否为真。