TypeError:Object在IE8 / IE9中不支持此属性或方法

时间:2012-10-18 01:19:10

标签: javascript actionscript-3 flex dojo swfobject

我正在动态地在一个html / dojo popup中嵌入一个flex swf。它在FF和Chrome中工作正常但在IE8 / IE9中我得到“TypeError:Object不支持此属性或方法”。在IE中第一次创建带有swf的弹出窗口一切正常。然而,一旦我隐藏弹出窗口并再次打开它然后尝试在flex内部调用actionscript函数它会抛出错误。任何帮助将不胜感激。以下是代码段:

var srchSuggestDlg;
var srchDlg;
var isSuggSwfInit = false;

/* Called on key up for the search box widget or when search arrow button is clicked
* Displays search suggestions inside popover below the search widget 
*/

cpm.home.index.searchKeyUp = function(evt) {

var srchInput = dojo.byId('xwt_widget_uishell_Header17_0_search_searchTextAP');

if(srchInput.value.length<3)
    return;

if(srchSuggestDlg && srchSuggestDlg.isShowingNow)
{
    try
    {
        swfobject.getObjectById("srchSuggSwf").updateSearchInFlex(srchInput.value);
    }
    catch(e){
        console.error("swf may not be ready 1",e);
    }
    return;
}

if(srchSuggestDlg == null)
{
    srchSuggestDlg = new xwt.widget.layout.Popover({pinnable: false, title: "Suggestions", sideAlign: false, autofocus: false, showHelp: false});
    var divx=dojo.create("div");
    divx.innerHTML="<div id='srchSuggDiv'></p></div>";
    srchSuggestDlg.containerNode.appendChild(divx);

    srchSuggestDlg.openAroundNode(srchInput);

    var flashvars = {swfId:"srchSuggSwf", searchString:srchInput.value};
    var params = {};
    params.quality = "high";
    params.bgcolor = "#ffffff";
    params.allowscriptaccess = "sameDomain";
    params.allowfullscreen = "true";
    var attributes = {};
    attributes.id = "srchSuggSwf";
    attributes.name = "srchSuggSwf";
    attributes.align = "middle";
    params.wmode="window";

    var cachecontrol = Math.floor(Math.random()*99999);

    swfobject.embedSWF("pages/modules/monitor/flex/SearchSuggestion.swf?"+cachecontrol,"srchSuggDiv","200","140","9.0.0","playerProductInstall.swf",flashvars, params, attributes);
    swfobject.createCSS("#srchSuggDiv", "display:block;text-align:left;");

}
else
{
    srchSuggestDlg.openAroundNode(srchInput);
    try
    {
        var srchInput1 = dojo.byId('xwt_widget_uishell_Header17_0_search_searchTextAP');
        //dojo.byId("srchSuggSwf").updateSearchInFlex(srchInput1.value);
        swfobject.getObjectById("srchSuggSwf").updateSearchInFlex(srchInput1.value);
    }
    catch(e) {
        console.error("swf may not be ready 2",e);
    }
}
};


/* Called from flex once flex swf is initialized 
*/

cpm.home.index.suggSwfInit = function(value){
var srchInput = dojo.byId('xwt_widget_uishell_Header17_0_search_searchTextAP');
try
{
    dojo.byId("srchSuggSwf").updateSearchInFlex(srchInput.value);
}
catch(e){
    console.error("swf may not be ready in 3",e);
}
};

1 个答案:

答案 0 :(得分:-1)

常见问题,请下载并安装Node.js = https://nodejs.org/en/download/

相关问题