1

我在 html/dojo 弹出窗口中动态嵌入了一个 flex swf。它在 FF 和 Chrome 中运行良好,但在 IE8/IE9 中我收到“TypeError:对象不支持此属性或方法”。在 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);
}
};
4

1 回答 1

-1

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

于 2016-09-29T11:29:48.620 回答