What I have in mind now is to use the progress event like this:
var downloadURL:URLRequest;
var fileName:String = "SomeFile.pdf";
var file:FileReference;
function FileReference_event_progress()
{
downloadURL = new URLRequest();
downloadURL.url = "http://www.aaa.com/webfile.exe";
file = new FileReference();
file.addEventListener(ProgressEvent.PROGRESS, progressHandler);
file.download(downloadURL, fileName);
}
function progressHandler(event:ProgressEvent):void
{
var file:FileReference = FileReference(event.target);
trace(event.bytesTotal);
}
This script will output the total size of the file (but will output it after the download process is started). What you can do is stop download immediately after the first piece of the file is received together with the total size - this is what I have like a workaround.
Another thing you can try is to use trace(file.bytesTotal);
instead of file.download(downloadURL, fileName);
but I'm not sure it will work without the process of download is started as there is no request send to the file.