3

我不知道这是怎么回事。我有 2 个占位符元素,我用 uploadify 实例替换。2 个占位符 html 元素完全相同,它们被替换为完全相同的 uploadify 代码(使用 jquery .each 循环遍历 2 个占位符)。唯一的区别是他们有不同的ID。

其中一个工作得很好,另一个抛出异常“无法读取未定义的属性 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 显示为“未定义”。我在它发生时对其进行了调试,并且它设置数据的第一行肯定发生了,但是到第二部分发生时它还没有定义。我完全不明白这一点。

4

1 回答 1

2

看起来很明显,但请检查您是否安装了闪存,我刚刚在我们的开发机器上遇到了确切的错误,这解决了问题。

于 2014-09-05T10:47:29.650 回答