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

Intercommunication Actionscript/Javascript

RANDY ROADS
Registered: Sep 3 2010
Posts: 2

Hello,

I'm searching to open external pdf file from an embedded flash (a user interface with many animated buttons to simplify the navigation on a CD-Rom). I don't want to display my pdf file in a browser, just in acrobat reader.

I read in a document from pdfscripting.com we can communicate between actionscript/javascript that way:
In flash : call the function : ExternalInterface.call"Myalert", "Hello Pdf");
In Acrobat : Using the function javascript at the document level : function Myalert(cMsg) {app.alert.(cMsg,3);}

Its Ok for Alert.

To open a file the javascript code is :
app.opendoc("mydoc.pdf";this);

When i change the "app.alert" with the "app.opendoc" the javascript console display "app.opendoc is not a function"

Is anybody know what kind of code is efficient to to this.

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
What you've used (app.opendoc) is indeed not a function, but app.openDoc is. If you're doing any scripting at all, you should get and read the Acrobat JavaScript reference.
RANDY ROADS
Registered: Sep 3 2010
Posts: 2
Many thanks for your help, I'm feeling a little bit stupid, I'm really a newbie in scripting.

I have one more question :

It's work fine, but the file always open in a new window.

In the "js_api_reference.pdf " i found the :
"openInPlace" which Specifies whether cross-document links are opened in the same window or opened in a new window.

But i don't know how to do. If i use the folowing code, it's doesn't work

app.openDoc("mydoc.pdf");
app.openInPlace = true;
try67
Expert
Registered: Oct 30 2008
Posts: 2398
I don't think this property applies to openDoc, but even if it does, you should set it to true BEFORE opening the file.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
Try67's correct - the openInPlace property only applies to links. The app.openDoc() method may functionally do what a link does, but it's not a link, so it doesn't respect the setting.