File download / URLRequest
Hi,
I'm trying to create a button that downloads an mp3 file and saves it to a users computer ie. you click the button and the standard windows box appears asking where you want to save the file.
I've tried the code below but the file opens and starts playing as opposed to asking the user where to save it. Am I on the right lines for achieving this?
Thanks for any pointers.
Robin
btn.addEventListener(MouseEvent.CLICK, myButtonFunction);
function myButtonFunction(event: MouseEvent)
{
var request:URLRequest = new URLRequest("test.mp3");
navigateToURL(request, "_blank");
}
1 click to download 1 song, so difficult!
I use Actionscrip 3.0
I have a button, draged it to the scene and gave it an instance name of btn.
I used the code(above) in the document class, and I get the errors :
1120 - Access of undefined property btn
1172 - Definition fl.controls:Button cound not be found.
I cant figure It out,
and need help.
Thanks alot!
Jimmy