Skip to main content
Participating Frequently
October 24, 2006
Question

No progresss information when downloading

  • October 24, 2006
  • 2 replies
  • 416 views
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);
};
This topic has been closed for replies.

2 replies

Inspiring
October 25, 2006
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?
kris66Author
Participating Frequently
October 25, 2006
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?

Inspiring
October 25, 2006
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.
kglad
Community Expert
Community Expert
October 25, 2006
there's no problem with your code (assuming file is defined correctly).
kris66Author
Participating Frequently
October 25, 2006
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 :)