Return to Snippet

Revision: 12295
at March 9, 2009 15:59 by chrisaiv


Initial Code
private var request:URLRequest;  
private var localRef:FileReference;  
  
protected function buttonClick():void  
{  
    request = new URLRequest("soundbyte.mp3");  
    localRef = new FileReference();    
  
    try  
    {  
        // Prompt and downlod file  
        localRef.download( request );  
    }  
    catch (error:Error)  
    {  
        trace("Unable to download file.");  
    }  
}

Initial URL

                                

Initial Description
Here's a simple example of how a user can download their file to their desktop

Initial Title
AS3: Download a File to the Desktop

Initial Tags

                                

Initial Language
ActionScript 3