Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
flash cs4文件参考。未在MAC上调用Event.COMPLETE,_Flash_Actionscript 3_Filereference - Fatal编程技术网

flash cs4文件参考。未在MAC上调用Event.COMPLETE,

flash cs4文件参考。未在MAC上调用Event.COMPLETE,,flash,actionscript-3,filereference,Flash,Actionscript 3,Filereference,我正在使用一个文件引用,但是我在MAC上运行Safari时遇到问题 编辑: 下面的例子也不适用于MAC上的Safari PC上的工作流按如下方式运行: 创建文件引用 为事件附加addEventListener。选择和事件。完成 调用browse()方法 在PC上,选择文件后会触发事件。选择。 当文件数据可用于闪存时,将触发事件.COMPLETE。如果我选择一个500 MB的文件,则在触发事件.COMPLETE之前需要几秒钟。如果在触发Event.COMPLETE之前尝试访问文件数据属性(例如读

我正在使用一个文件引用,但是我在MAC上运行Safari时遇到问题

编辑: 下面的例子也不适用于MAC上的Safari

PC上的工作流按如下方式运行:

  • 创建文件引用
  • 事件附加
    addEventListener
    。选择
    事件。完成
  • 调用
    browse()
    方法
  • 在PC上,选择文件后会触发
    事件。选择
    。
    当文件数据可用于闪存时,将触发
    事件.COMPLETE
    。如果我选择一个500 MB的文件,则在触发
    事件.COMPLETE
    之前需要几秒钟。如果在触发
    Event.COMPLETE
    之前尝试访问文件数据属性(例如读取数据流),则会收到空引用错误

    到目前为止还不错

    但是,在MAC上(特别是Safari,未测试其他浏览器),不会触发
    事件.COMPLETE

    我已经检查了Adobe文档,上面说上传完成后会触发
    事件.COMPLETE
    。那么,当
    fileReference
    解析了文件,但还没有调用upload方法时,为什么它会在windows上被触发呢

    有人能帮忙吗

    以下是我正在处理的代码片段:

    public function browseFile(target:Object):void 
    {
       var imagesFilter:FileFilter = new FileFilter("Allowed files", "*.jpg;*.bmp;*.flv;");
       fileReference.browse([imagesFilter]);
       fileReference.addEventListener(Event.SELECT, fileSelect); 
       fileReference.addEventListener(Event.COMPLETE, fileSelectComplete); 
    }  
    
    
    private function fileSelect(event:Event):void 
    {    
       // update label - IMPORTANT for large files as there's a delay while flash parses file, before control is handed back to this script...
       setStatusLabel("...loading file");
    
       var fileReference:FileReference = event.target as FileReference; 
    
       fileReference.addEventListener(Event.COMPLETE, fileSelectComplete); 
    
    
       // load the file into the fileReference object
       fileReference.load();  
    
    } 
    
    
      // Called when upload file has been processed by flash (a few secs for large files, or fileRef.data is null...)
    private function fileSelectComplete(event:Event):void 
    {
       var fileReference:FileReference=event.target as FileReference; 
    
       trace("ready to do things - but not fired on Safari on a MAC ");
    }
    

    我似乎已经使用DataEvent.UPLOAD_COMPLETE_数据而不是Event.COMPLETE使它工作了

    var fileRef:FileReference = new FileReference();
    fileRef.addEventListener(Event.SELECT, onFileSelected);
    fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, onUploadComplete);
    
    function onFileSelected(event:Event):void {
        statusBar.text = "File upload started";
        fileRef.upload(FILE_UPLOAD_URL);
    };
    
    function onUploadComplete(event:Event):void {
        statusBar.text = "File upload completed";
    };
    

    肯定是SDK3.4的一个bug,我有一个工作要做

            var fr:FileReference = e.currentTarget as FileReference;
            fr.addEventListener(Event.COMPLETE, onModelDone);
            fr.addEventListener(ProgressEvent.PROGRESS, onProgress);
    //            trace("loading...");
            setTimeout(function():void {fr.load()}, 1);  // put it here for delay
    
    我在sdk3.9上试过,但还是一样,所以我在这里提交了一个bug:

    我可以确认问题,但我还没有找到解决方案。太棒了!我会找零钱,然后给你回电话-对不起,这么长时间了!