-1

I have a project with four different buttons in flash which will download doc files locally. Since I am new to flash scripting i don't know how to start with. Can anyone help to start with that. Thanks in advance.

Benjamin
  • 2,612
  • 2
  • 20
  • 32

1 Answers1

1

Here you go:

private var request:URLRequest;  
private var localRef:FileReference;  

protected function buttonClick():void  
{  
  request = new URLRequest("http://www.yourdomain.com/soundbyte.mp3");  
  localRef = new FileReference();    

  try  
  {  
     // Prompt and downlod file  
     localRef.download( request );  
  }  
  catch (error:Error)  
  {  
     trace("Unable to download file.");  
  }  
}

You should give a read to FileReference Class (If you are using AIR i suggest you to use File Class instead).

SharpEdge
  • 1,782
  • 1
  • 10
  • 20