Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Flash ActionScript Download Files Procedures

With Flash ActionScript 3 and latest version of Flash Player, users are allow to browse their local computer drive to download files from web server. The download process involves involves the following steps:

  1. Create a new instance of the FileReference class to work with.
  2. Create a new URLRequest object specifying the location or URL of the download file.
  3. Call the download method with the URLRequest object as the parameter.
  4. Check for any errors during the download process.

The Flash ActionScript download file procedures can be illustrated with the following diagram:

flash actionscript 3 download file procedures

Flash ActionScript Codes:

//Create a new instance of the FileReference class to work with.
var myfileReference:FileReference = new FileReference();

 

// Create a new URLRequest object specifying the location or URL of the download file.
// Use "http://www.YourDomain.com/file.txt" for URL

var myRequest:URLRequest = new URLRequest("file.txt");

 

// Call the download method with the URLRequest object as the parameter.
myfileReference.download(myRequest);

 

 

Remarks:

This Flash Actionscript 3 tutorial discuss how to use AS3 to download file from webserver to local computer drive.