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.
Asked
Active
Viewed 103 times
1 Answers
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
-
what kind of error? buttonClick function must be the callback for a Mouse.CLICK event to work. – SharpEdge Aug 10 '14 at 11:43