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

朱雀 2022-08-01 14:00 209阅读 0赞

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

  1. SWFUpload.prototype.initSWFUpload = function (settings) {
  2. try {
  3. this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
  4. this.settings = settings;
  5. this.eventQueue = [];
  6. //this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
  7. //名称重复 SWFUpload.movieCount++不能有效累加导致出现重名现象
  8. //this.movieName = "SWFUpload_" + parseInt(100*Math.random());
  9. //,从而修改为随机数 modify by 志超 2015.05.21
  10. var mydate = new Date();
  11. this.movieName = "SWFUpload_" + mydate.getTime().toString();

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

  1. this.movieElement = null;
  2. // Setup global control tracking
  3. SWFUpload.instances[this.movieName] = this;
  4. // Load the settings. Load the Flash movie.
  5. this.initSettings();
  6. this.loadFlash();
  7. this.displayDebugInfo();
  8. } catch (ex) {
  9. delete SWFUpload.instances[this.movieName];
  10. throw ex;
  11. }
  12. };

发表评论

表情:
评论列表 (有 0 条评论,209人围观)

还没有评论,来说两句吧...

相关阅读