I got a question this morning that got me thinking about some other issues I’ve had with Rich Media Annotations as well. Here’s the question…
I have a swf file created in Flex running in a PDF which opens in a floating window when clicked.
I can get the floating window to close by allowing “Disable Content” in the context window, but I’m trying to achieve the same effect when an “OK” button is clicked in the swf file. This button calls a function in the PDF and should ideally then close the floating window.
Any idea how to do this?
My first response was “No – no idea”. Since the Rich Media Annotation will be listening for a response from Acrobat, Acrobat will crash if you try to close the window programmatically. The same thing happens when you try to programmatically change pages in a PDF. I tried working around this issue myself multiple times, filed bug reports and then finally gave up. After the above question came in from an earlier post, I decided to try again and I asked the engineer who actually wrote the code for some suggestions on how to work around the problem. Bingo! After a pretty short email thread we got it.
Closing a Floating Rich Media Flash Window:
ExternalInterface.call( “eval“, “app.setTimeOut(‘rm = this.getAnnotsRichMedia(0); rm.activated=false;’,250);“);
There are four layers you need to punch through to get the code you actually want to run to work:
- Finally, the ExternalInterface
allows us to pass all that to Acrobat.
This example PDF demonstrates the ability to flip pages and close the floating Rich Media Flash Annotation using this work-around.
The MXML Source – You’ll need to supply your own bitmap for the embedded image before compiling.