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 Basic Download File Example

This flash tutorial shows the most basic codes that allow users downloading files from webserver to their local computer.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

This Flash ActionScript tutorial shows how to allow users to download a file from the webserver to their computers.

The Flash Movie of this tutorial is shown as above.

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.
// URL
// var myRequest:URLRequest = new URLRequest("http://domain.com/index.html");
// relative location
var myRequest:URLRequest = new URLRequest("download_file.txt");

 

function downloadFile (event:MouseEvent):void {

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

}

// Hook up the button with the function downloadFile
download_btn.addEventListener(MouseEvent.CLICK, downloadFile);

Download Flash Source File:

Flash Source File as3-download-file-01.fla

Remarks:

This Flash ActionScript tutorial shows how to downloading files from webserver to local computer of users.