can anyone help me with how to link to a pdf in Actionscript 3
Using this code at the moment, and it does not seem to work:
var link:URLRequest = new URLRequest(“myPdf.pdf”);
button_mc.addEventListener(MouseEvent.CLICK, OnClick );
function OnClick(event:MouseEvent):void
{
navigateToURL(link);
}
in AS3 you use navigateToURL, not getURL, and you give it a URLRequest that is created using a string, not just the string.
rondog has it perfect and if you want it to open in a new window add a second argument to the navigateToURL function that is “_blank”
The reason your first one was not working was because you had an extra semi-colon in there. Semi colons go after a line of code, not after the string inside the function call
you could just zip up the pdf into a archive file and then put it on your server and make a direct link to it. It will automatically start downloading to the desktop once someone clicks a link to a zip file good luck
thanks for your replies.
the zip file may be the easiest for my needs but I
will start playing around with some simple php stuff too.
Ill add it to my to do list.