File Download

Hey everyone,

Got a very simple problem. Trying to download a file in AS3. Code looks pretty simple but I must be doing something wrong. It opens the file reference box, all the data looks good but the file is not saved. Anyone got any ideas? This is a simple standalone file so I just put it in frame 1 of the timeline. I’m pulling in my data from FlashVars but I know all of that works.

var fileRef:FileReference = new FileReference();
var DownloadFile:String = Object(LoaderInfo(this.loaderInfo).parameters).DownloadFile;
var LinkText:String = Object(LoaderInfo(this.loaderInfo).parameters).LinkText;
var Filename:String;
var DLReq:URLRequest = new URLRequest(DownloadFile);

//  Trims a fully qualified URL to just the filename
if (DownloadFile.lastIndexOf("/") != -1) {
    Filename = DownloadFile.substr(DownloadFile.lastIndexOf("/")+1);
} else if (DownloadFile.lastIndexOf("\\") != -1) {
    Filename = DownloadFile.substr(DownloadFile.lastIndexOf("\\")+1);
} else {
    Filename = DownloadFile;

btn.buttonMode = true;
btn.addEventListener(MouseEvent.CLICK, onClick);

function onClick(e:MouseEvent):void
{, Filename);

Thanks for your help!