6 Replies Latest reply on Mar 27, 2007 11:26 AM by Cyandi_Man

    FILE DOWNLOAD CLASS?

    Cyandi_Man
      Hi I am working on a webpage that allows the user to download files from the server. However i am not sure how to modify the code to show the download status so the user knows its actually download sumthing - i was under the impression that this is supposed to show automatically - if so - whats wrong with my code that is not allowing this to display?

      the code i am using is as follows:

      on(release){

      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);
      var url:String = " http://www.website.com/thefile.jpg";
      if(!fileRef.download(url, "thefilejpg")) {
      trace("dialog box failed to open.");
      }
      }

      In IE my photos download - but i dont see the download status - same with mp3s
      In FireFox - nothing happens at all even though i get the pop up window asking the location to dowload the file.
      help please!