0 Replies Latest reply on Apr 14, 2010 12:12 AM by mfriasv

    Download file from ASP

    mfriasv Level 1

      Hello,

       

      my application allows users download files to their local drives:

       

      private function downloadLayer(tree:Array):void
              {
                  for (var i:uint;i<tree.length; i++)
                  {
                      var url:String = "http://myServer/website/getLayer/Default.aspx?sdeFeatName="+ tree[i].@name +"";           
                      ExternalInterface.call("window,open", url);
                  }   
              }

       

      This works perfectly but it forces the browser to open a new window which is not good if the user has the popup blocker on.

       

      I was thinking that another way to achieve that is using FileReference and URLRequest. However this code only returns Default.aspx:

       

      var url:String = "http://maps.helcom.fi/website/getLayer/Default.aspx?sdeFeatName="+ tree[i].@name +"";           
                 downloadURL.url= url
                 fileReference.download(downloadURL);

       

      I read that a solution would be to first use HTTPService to get the file and then pass the URL to URLRequest. My attempts to do that have failed so far. Can anyone provide an example?

       

      Regards,

      Manolo