0 Replies Latest reply on Jun 12, 2010 5:27 AM by ekschperte

    Calling Actionscript from Acrobat Javascript

    ekschperte

      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!)...
      ...
      xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="Setup()">
      ...
      <mx:Script>
              <![CDATA[
                  import flash.external.ExternalInterface;

       

                  public function clickRotate():void
                  {
                      ExternalInterface.call("as_rotate");
                  }
                  public function SetMode():void
                  {
                      check.selected = true;
                  }
                 
                  public function Setup():void {
                      if (ExternalInterface.available)
                      {
                          ExternalInterface.addCallback("setRotatedValueToFlash", SetMode);
                      }
                  }
              ]]>
      </mx:Script>
      <mx:Panel title="User Interface">
      <mx:Button label="Rotate" click="clickRotate()"/>
      <mx:CheckBox label="Rotated" id="check"/>
      </mx:Panel>
      ...

       

      And as part of my JavaScript:

       

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