These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Close a floating window

Koen_Wyckmans
Registered: Feb 9 2009
Posts: 18

I've made a movieplayer in flash that has to be embedded in a PDF file. I've also added a closing button, BUT...

It works, on the first page. If I make a (flash)button on another page in the PDF document it doesn't close the floating window. I know that you can close the floating window by clicking on the 'invisible' button in the black frame around the swf, but I want to add a visible (more beautiful) closing button.

Can someone solve my problem?

Thanks!

My Product Information:
Acrobat Pro Extended 9.0, Macintosh
joshcorey
Registered: Jul 14 2008
Posts: 79
There are two other threads on closing a floating window. I am posting the "answer" from Thom Parker:

thomp wrote:
Closing a floating RichMedia Annot is done by setting the "activated" property of the annot to false. I've set this up where I have a PDF form button that activates the flash. Then I make the annot on the page really small and hide it underneath the button. The code in the button just sets "activated" to true.Now for the diffucult part. Closing the floating player from a button on the SWF. The problem is that when the SWF ActionScript calls a JavaScript functon, the Flash player waits for a response from Acrobat JavaScript. If the call closes the Flash player then all heck breaks loose and Acrobat hangs or crashes. The trick is to decouple the actions with a timout script. I've been trying to figure this one out for a while and this solutions was just provided to me today by Joel Geraci, the Acrobat Technical Evangelist.

Use this line of code from the close button in the SWF
ExternalInterface.call("eval","app.setTimeOut('this.getAnnotRichMedia(this.pageNum,\"RM0\").activated=false;',100);");
The setTimeOut fucntion returns right away so the player is happy. Then the deactivation happens outside the context of the call for the RichMedia, making Acrobat happy.

Make sure you get all the quotes right, and the Annot name right. I've got this set up in one of my examples so that when the Rich media annot is setup, it finds it's own name and page number. Then sets them as persistent values. That way nothing needs to be hard coded in the SWF and it can be used on any PDF by just copying the RichMedia annot from one PDF to another.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]
Josh
tallmediaman
Registered: Mar 22 2010
Posts: 2
Hey Josh. Do you happen to have any project files I can peek at to figure out how to pull this off? I am stumped.

Thanks
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You'll find several examples on this blog:
http://blogs.adobe.com/pdfdevjunkie/introducing_the_video_player_p.php

Joel has written extensively about flash in PDF and if you look around his blog you'll find all kinds of examples. Most of these are Flex mxml code. So if you're looking specifically for flash builder code make sure of what you are downloading.

One of the first thing you need to do to make this work is to be able to identify the name of the RichMedia Annotation in Acrobat. Do you have this part figured out?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script