Downloading files from inside the .swf

Hi,

I’m trying to use the new file reference.download method.
Im importing the class, and then using the code that I learnt from the help section, with my details from where I wanted to download the file from, in the bottom section.
Here’s the code that I’m using on the frame.


import flash.net.FileReference;

btnWargame.onRelease = function () {

var listener:Object = new Object();

listener.onSelect = function(file:FileReference):Void {
trace("onSelect: " + file.name);
}

listener.onCancel = function(file:FileReference):Void {
trace(“onCancel”);
}

listener.onOpen = function(file:FileReference):Void {
trace("onOpen: " + file.name);
}

listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
}

listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
}

listener.onIOError = function(file:FileReference):Void {
trace("onIOError: " + file.name);
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
var url:String = “http://www.foreignlegionmusic.com/mp3s/amuzia/2/Wargame.mp3”;
if(!fileRef.download(“http://www.foreignlegionmusic.com/mp3s/amuzia/2/Wargame.mp3”, “Wargame.mp3”)) {
trace(“dialog box failed to open.”);
}
};


This is letting me open and direct where I want to download to on my computer.
It is also returning the onSelect trace plus the filename.

This is all its doing though, it never actually downloads the file.

Im a bit stuck and really need some help to finish my project.
If anyone knows what I’m doing wrong with this it would help alot.

cheers