Attempting for the first time to code a pdf download. Here is the code I’m using:
pdfBtn.addEventListener(MouseEvent.CLICK, dothis);
function dothis(e:MouseEvent):void {
var fr:FileReference = new FileReference();
var req:URLRequest = new URLRequest("this.pdf");
try {
fr.download(req);
}
catch (illegalOperation:IllegalOperationError) {
// code to handle an illegal operation error
}
catch (security:SecurityError) {
// code to handle a security error
}
}
Can anyone tell me what I’m doing wrong here? TIA.