4 Replies Latest reply on Nov 16, 2007 12:22 AM by RajeshBhadra

    FileReference

    CF_crazee
      Heres my simple DownloadFile class
      package com.classes
      {

      import flash.net.FileReference;
      import flash.net.URLRequest;

      public class DownloadFile
      {
      private var fileToDownload:FileReference;

      public function DownloadFile(){
      this.fileToDownload = new FileReference();
      }

      public function downloadFile(url:String, fn:String):void
      {
      var request:URLRequest = new URLRequest(url);
      try
      {
      fileToDownload.download(request, fn);
      }
      catch (error:Error)
      {
      trace("Unable to download file.");
      }
      }
      }
      }

      heres the call

      var downloadFile:DownloadFile = new DownloadFile();
      downloadFile.downloadFile(extractURL, "extractedData.zip");


      The extractURL during runtime evaluates to http://localhost/output/testAXL_magellan5716589625.zip since this is my development machine

      The file dialog box opens with the default name and I click Save but nothing saves . Any ideas what I am doing wrong here?
      Thanks