8 Replies Latest reply on Oct 25, 2006 4:23 AM by kris66

    No progresss information when downloading

    kris66
      I have a small mp3 player on our band website that have the option for people to download our mixes. Everything work perfect except for one thing. The download is working and the files get downloaded but there's no progress information (progress bar) while the download goes on. The files are 75MB so they do not exceed the 100MB issue. What's going wrong?

      Here's the script:


      import flash.net.FileReference;
      var listener:Object = new Object();

      listener.onSelect = function(file:FileReference):Void {
      trace("onSelect: " + file.name);
      }

      listener.onCancel = function(file:FileReference):Void {
      trace("onCancel");
      }

      listener.onOpen = function(file:FileReference):Void {
      trace("onOpen: " + file.name);
      }

      listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
      trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
      }

      listener.onComplete = function(file:FileReference):Void {
      trace("onComplete: " + file.name);
      }

      listener.onIOError = function(file:FileReference):Void {
      trace("onIOError: " + file.name);
      }
      var fileRef:FileReference = new FileReference();
      fileRef.addListener(listener);

      // save button action
      saveBut.onPress = function() {
      var local:String = file.substr(file.lastIndexOf("/")+1);
      fileRef.download(file, local);
      trace(local);
      };
        • 1. Re: No progresss information when downloading
          kglad Adobe Community Professional & MVP
          there's no problem with your code (assuming file is defined correctly).
          • 2. Re: No progresss information when downloading
            macdaddy256
            You say the 'progress bar' isn't working, so I assume you've simplified the code for posting here. Is the onProgress trace working? Are all of the other event traces for this FileReference working ok?
            • 3. No progresss information when downloading
              kris66 Level 1
              quote:

              Originally posted by: flatcoat99
              You say the 'progress bar' isn't working, so I assume you've simplified the code for posting here. Is the onProgress trace working? Are all of the other event traces for this FileReference working ok?


              No all code is there and working fine. What I mean is. Just like when you download normally inside a html page you get a pop up window and you choose where the download should go on your computer. When you start the download you can see the progress of the download. For some reason the progress of the download does not show when the download link is from a flash file. That's the problem. Hope I explained it clear. It got nothing to do with a designed progress bar inside flash as the ones you use when you load a flash movie..

              Ps. Could it be because it's a direct download link to a mp3 file and not a zip file?

              • 4. Re: No progresss information when downloading
                kris66 Level 1
                quote:

                Originally posted by: kglad
                there's no problem with your code (assuming file is defined correctly).


                The file defining is correct and the mp3 file does get downloaded but it's impossible to tell that it's downloading since there's no progress information showing. Which leads people to think the download does not work = the problem :)
                • 5. Re: No progresss information when downloading
                  macdaddy256 Level 1
                  Ah! No, the download progress of a FileReference doesn't show in the browser's download window - you have to take care of download feedback yourself within the onProgress handler.
                  • 6. No progresss information when downloading
                    kris66 Level 1
                    quote:

                    Originally posted by: flatcoat99
                    Ah! No, the download progress of a FileReference doesn't show in the browser's download window - you have to take care of download feedback yourself within the onProgress handler.


                    Now we are getting somewhere :)

                    I am not a hardcore coder even though I got some experience. Any good tutorial or link that could help me?

                    And thanks a lot for the help. Now I at least know it is possible to get it working :)

                    Kris

                    • 7. No progresss information when downloading
                      macdaddy256 Level 1
                      here's a part-code listener that might make it clearer - in this case it just gives a percentage figure in a textfield.
                      • 8. Re: No progresss information when downloading
                        kris66 Level 1
                        quote:

                        Originally posted by: flatcoat99
                        here's a part-code listener that might make it clearer - in this case it just gives a percentage figure in a textfield.


                        Thanks for the code but I am probably a total nob :) I can't seem to make it work at all. The result is the same as before.

                        I will post the total code Please let me know where I need to insert the code and if I need to remove something in the original code.

                        Thanks for your help and patience :)