2

I have a callback in flash that cancel file upload, and is executed from javascript:

        public function initApp():void 
        {                               
            ExternalInterface.addCallback("cancelUpload", cancelUploadRequest);
        }                       

        public function cancelUploadRequest(filename:String):void 
        {                                       
            for each (var file:FileReference in files.fileList) {                                       
                if (file.name == filename) {                        
                    file.cancel();                      
                }
            } 
        }

where files is a filereferencelist object containing the selected files. If i select multiple files and call 2 or more time this callback only one file is being canceled the other are uploaded successfully.

croppio.com
  • 1,823
  • 5
  • 28
  • 44

1 Answers1

0

in your code:

    if (file.name == filename) {    

This line checks and validates only for one file (if it is in the list) and enables deletation of it.

Volkan
  • 2,212
  • 1
  • 14
  • 14
  • If multiple file names are passed into the function via a single filename string, like "file1.img,file2.wav" etc, you have to parse the filename first then check it IMHO. Try tracing the filename when you select multiple files. – Volkan Mar 18 '13 at 10:03
  • Then only one file is deleted... Maybe data in files object are blown at the consecutive calls. have you checked them? – Volkan Mar 18 '13 at 10:09
  • 1
    The function is called 2 times, each time with different filename. What do you mean data in files object are blown at consecutive calls? – croppio.com Mar 18 '13 at 11:10
  • Two possibilities 1) The one of the filenames does not exist in the files.filelist. 2) files.filelist is changing bw calls. If you trace these then we will understand the problem better. Is it something like a programming bug or just a *magic* adobe problem... – Volkan Mar 18 '13 at 11:37