I have a Flash cs4 swf with links to pdf files. I have placed the swf in an Acrobat 9 PDF and I want the links to call the external PDFs. If that isn't possible, I want it to link to pages within the final pdf.
Here is my actionscript in Flash for the links (which work correctly in the swf):
africa_btn.addEventListener(MouseEvent.MOUSE_DOWN, africaHandler);
function africaHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("docs/8115_S_S Dir_Africa.pdf"));
}
mideast_btn.addEventListener(MouseEvent.MOUSE_DOWN, mideastHandler);
function mideastHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("docs/8115_S_S Dir_Middle_East.pdf"));
}
I know I have to add document Javascript in Acrobat to make the swf function. But I a lost.
I can only find flex documentation for this issue.
Thanks in advance.
Without knowing more about your delivery method I will try to give you some options:
1) You can host the PDF's on a server use absolute paths for the PDF's it will work just fine using your code (replacing the relative paths with absolute paths to the PDF's) and no javascript required.
2) Another option is to use an externalInterface.call in Actionscript to javascript and use javascript to do one of two things, navigate to a page in the PDF (an option you mentioned as a back up) or to open a file attachment (PDF attachment on the source PDF, not as a resource to the ). I don't know the javascript API myself but there are API's for both methods. If you do go the first route (navigating to a page within the PDF) take a look at the following blog:
http://blogs.adobe.com/pdfdevjunkie/2008/09/how_do_you_close_a_floating_ri.php
The blog shows how to work around a bug where Acrobat can crash when programmatically changing pages in the PDF when there is an active Richmedia annotation.
ᅠ
AFTER the bug on relative URL's is fixed you will have the following options:
1) Host both the SWF and the PDF's on a server and use the absolute URL to your SWF as the source for your Richmedia annotation (URL's are supported). (Remember this will not work until there is an update to Acrobat 9)
2) You could (again, after this bug is fixed) host the PDF's and SWF and load the SWF via "loader" from an embedded SWF. (Remember this will not work until there is an update to Acrobat 9)
I would be happy to clarify anything I said. Flash security is not necessarily easy to understand and it gets trickier in a PDF. If this hasn't helped let me know your delivery method and I will take another look.