11 Replies Latest reply on Jun 22, 2012 10:51 AM by Draco18s

    Javascript Link: Application Level?

    Draco18s Level 1

      I have a link that uses the "run a javascript" for its action when clicked.


      How would I go about getting this button to call a function sitting at the Application or Document layer?


      Application would be better, as we're trying to link togeth a Flex AIR application with some PDF reprints for this client and have the annotations in the PDF call a video (which would play at the Flex level).


      Currently we can run a Flex application and the PDF in an HTML page and communicate between the two using Javascript in the HTML as well, however, we are unable to communicate back up the hierarchy: that is, getting a PDF link activate a javascript function in the HTML (which would then forward the even to the Flex).


      In fact, I can't even get these javascript running buttons to call a function at the Document layer, severly limiting what I am able to do.


      I have a function, myOnMessage, in the Document JavaScripts editor.  How would I get the javascript in the Link Properties -> Actions to call that function?


      Better yet, can I call the sendMessage function (or similar) I have that is defined in the HTML page?  Here's the script I have in the HTML that loads and communicates with the PDF:


           function init()
                var pdfFile = window.runtime.flash.filesystem.File.applicationDirectory.resolvePath("test.pdf");
                document.getElementById("PDFObj").data = pdfFile.url;
           function sendMessage(message)
                catch (error)
                     alert( "Error: " + error.name + "\nError message: " + error.message);