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

Calling Actionscript from Adobe Javascript

ekschperte
ekschperte's picture
Registered: Jun 12 2010
Posts: 29
Answered

Hi,

I have a pdf with an embedded SWF. Also there is a 3D annotation included. I try to call a Actionscript function in the SWF from the Acrobat Javascript in the PDF and it does not work. The other way (AS->JS) works perfect (with ExternalInterface.call(...)).
I have the 3D annotation and the embed SWF on page 0 inserted.

I tried the following code, which does not work. All it should do is: After clicking the "Rotate"-button, the 3D annotation has to be rotated (which works!) and then the Flash checkbox in the SWF should be activated (which works not!)

public function SetMode():void
{
check.selected = true;
}

public function Setup():void {
if (ExternalInterface.available)
{
ExternalInterface.addCallback("setRotatedValueToFlash", SetMode);
}
}

And as part of my JavaScript:

function setRotatedValueToFlash()
{
getAnnotsRichMedia(0)[0].callAS("SetMode");
}

UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
Your function names are mixed up - in JS you're calling for exposed function named "SetMode", but in the AS you've exposed it using the alias "setRotatedValueToFlash".
ekschperte
ekschperte's picture
Registered: Jun 12 2010
Posts: 29
Thanks a lot! :)