2012-09-14 50 views
3

我不知道這是怎麼回事。我有2個佔位符元素,我用uploadify實例替換。 2個佔位符html元素完全相同,並且它們被替換爲完全相同的uploadify代碼(通過使用jquery .each循環2個佔位符)。唯一的區別是他們有不同的ID。Uploadify無法讀取屬性'queueData'

其中一個工作完全正常,另一個拋出異常'不能讀取屬性queueData未定義'。我檢查了uploadify代碼,這是因爲它找不到應該存儲的swfupload。 uploadify內相關的代碼是在這裏

if (flashInstalled) { 
       // Create the swfUpload instance 
       window['uploadify_' + settings.id] = new SWFUpload(swfUploadSettings); 
       var swfuploadify = window['uploadify_' + settings.id]; 

       // Add the SWFUpload object to the elements data object 
       $this.data('uploadify', swfuploadify); 

,並在那裏它試圖從$ this.data

// Start uploading files in the queue 
    upload : function() { 

     var args = arguments; 

     this.each(function() { 
      // Create a reference to the jQuery DOM object 
      var $this  = $(this), 
       swfuploadify = $this.data('uploadify'); 

      // Reset the queue information 
      swfuploadify.queueData.averageSpeed = 0; 
      swfuploadify.queueData.uploadSize = 0; 

swfuploadify檢索它的一部分變成了爲「未定義」。我在調試過程中發現了這種情況,第一行確定了這些數據肯定發生了,但是到第二部分發生的時候它還沒有定義。我根本不明白這一點。

回答

2

看起來很明顯,但檢查你是否安裝了flash,我只是碰到了我們開發機器上的確切的bug,這就解決了這個問題。

+0

Omg,經過數小時在線搜索,這是解決方案。謝謝! – Refilon