swftools icon indicating copy to clipboard operation
swftools copied to clipboard

issue with `FileReference.download()` in AS2

Open ousia opened this issue 2 years ago • 3 comments

[This question comes from ruffle-rs/ruffle#15297.]

I have the following source for swfc from SWFTools:

.flash filename="frd.swf" background=white bbox=600x600 version=8

.frame 1
.action:

function download_file()
{
   var listener = new Object();
   var fileref = new FileReference();
   fileref.addListener(listener);
   fileref.download("http://example.com","debug-cancel.txt");
}
download_file();
.end
.end

I cannot make it work. I get errors if I replace new FileReference() with new flash.net.FileReference() (or if I prepend import flash.net.FileReference; to the function).

Am I missing something here or is it simply that swfc cannot handle FileReference.download() in AS2?

Many thanks for your help.

ousia avatar Feb 27 '24 12:02 ousia

My guess is that FileReference.download() is not implemented in AS2.

ousia avatar May 19 '24 11:05 ousia

@ousia FilReference.download() is implemented in AS2, I coded it for many projects. https://open-flash.github.io/mirrors/as2-language-reference/flash/net/FileReference.html

ROBERT-MCDOWELL avatar May 19 '24 11:05 ROBERT-MCDOWELL

Sorry, @ROBERT-MCDOWELL, I know FileReference.download() is part of AS2.

I suspect that the AS2 code generated by swfc cannot handle FileReference.download().

I thought that the included sample was valid AS2 code, but I’m afraid it isn’t working.

Many thanks for your help.

ousia avatar May 19 '24 12:05 ousia