微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

uploadify"ID SWFUpload_0 is already in use..."错误的解决方法

在使用 uploadify时 遇到同时加载的多个页面中包含uploadify组件时就会出现“ID SWFUpload_0 is already in use. The Flash Object Could not be added”的错误,分析代码就会发现,时因为名字累加的问题,解决方法如下

SWFUpload.prototype.initSWFUpload = function (settings) {
try {
    this.customSettings = {};   // A container where developers can place their own settings associated with this instance.
    this.settings = settings;
    this.eventQueue = [];

    //this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
    //名称重复  SWFUpload.movieCount++不能有效累加导致出现重名现象
    //this.movieName = "SWFUpload_" + parseInt(100*Math.random());
    //,从而修改随机数   modify by 志超 2015.05.21
    var mydate = new Date();
    this.movieName = "SWFUpload_" + mydate.getTime().toString();

//,从而修改随机数 modify by 志超 2015.09.07

this.movieElement = null;


        // Setup global control tracking
    SWFUpload.instances[this.movieName] = this;

    // Load the settings.  Load the Flash movie.
    this.initSettings();
    this.loadFlash();
    this.displayDebugInfo();
} catch (ex) {
    delete SWFUpload.instances[this.movieName];
    throw ex;
}
};

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐