8 Replies Latest reply on Apr 21, 2009 3:11 PM by The-Face

    Veiwing a PDf using Activex Direct to stage

    The-Face

      I'm new to Director, and to the scripting side especially. I have managed to complete all of my project except for when I get to a point I need to be able to have the users click on a button and have a PDF load in the PDF's Activex sprite. This is the code I have attached to the button:

       

      on mouseup

           sprite(17).src = the moviePath &"OSME.pdf"

      end

       

      When they click on the button, nothing happens, any ideas on why this wouldnt be loading?

       

      Thanks!

      Tim

        • 1. Re: Veiwing a PDf using Activex Direct to stage
          Sean_Wilson Adobe Community Professional

          First: are you sure the button is receiving the mouseUp message?

          on mouseUp

            alert "mouseUp"

            sprite(17).src = the moviePath & "OSME.pdf"

          end

          If the button is a Flash Component, you may need to change 'on mouseUp' to 'on click' (or set the eventPassMode of the member to #passAlways)

           

          Next: are you sure sprite(17) holds your AX control at the moment this code runs?

          on mouseUp

            alert "mouseUp:" && sprite(17).member.type

            sprite(17).src = the moviePath & "OSME.pdf"

          end

           

          Finally: are you sure the PDF exists at the path you are providing? The easiest way to determine whether a file exists is to use a 3rd-party xtra that implements a method to test this. Something like FileXtra4, Buddy API or even PRegEx. You could also use the built-in FileIO xtra, but this makes harder work of it than it needs to. Try the first couple of suggestions before pursuing this one further.

          • 2. Re: Veiwing a PDf using Activex Direct to stage
            The-Face Level 1

            Hi Sean,

             

            Thanks for the suggestions. I tried your codes, and made sure it was happening on mouse up, and  sprite 17 was the activex sprite (see attached file) But even still after I click ok to the alert box nothing happens.

             

            I'm toying around with the Xtras you mentioned, but Im not sure how to install and use them (sorry, I'm really new at this)

            • 3. Re: Veiwing a PDf using Activex Direct to stage
              The-Face Level 1

              on second thought, do i have to do anything to the activex control? Other than just add it to cast members and drag it to the stage?

              • 4. Re: Veiwing a PDf using Activex Direct to stage
                Sean_Wilson Adobe Community Professional

                You shouldn't have to do anything with the AX sprite to make it work (assuming it implements a src property). I assume you have a copy of Buddy API for your platform already - if not, grab it from here. To install it you need to place it in the folder named Xtras inside the folder your authoring application is installed. You must be on Windows to be running AX controls, so you should put it in the 'Adobe Director 11\Configuration\Xtras\Scripting\' folder. Restart Director and the xtra should be available. To test that it's installed properly you could check the Scripting Xtras drop-down list in either your message window or a script window (it's the menu with an xtra icon) - you should see an entry for BudAPI.

                Now alter your script like so:

                on mouseUp

                  tPath = the moviePath & "OSME.pdf"

                  if baFileExists(tPath) then

                    sprite(17).src = tPath

                  else

                    alert "File not found:" && tPath

                  end if

                end

                 

                Sorry, I can't seem to view your attachment - how do I access it?

                • 5. Re: Veiwing a PDf using Activex Direct to stage
                  The-Face Level 1

                  Hi Sean,

                   

                  Thanks again for trying to help. When I installed BuddyAPI and used your code, again nothing happens when I click the button. I tested to see if the API was working by moving the PDF out from the main directory. Sure enough when I do that, it gives me the error "file not found". So it is seeing the file in the correct directory, just nothing is popping up in the AX cast member when I push the button.

                   

                  Any other ways we could test it?

                   

                  thanks again for your help!

                  Tim

                   

                  (I dont know why you couldn't download the other attachment, it just says it's queued?

                  • 6. Re: Veiwing a PDf using Activex Direct to stage
                    Sean_Wilson Adobe Community Professional
                    So it is seeing the file in the correct directory, just nothing is popping up in the AX cast member when I push the button.

                     

                    Any other ways we could test it?

                     

                    Buddy API is installed and working correctly, and there seems to be nothing wrong with your code. I'm out of suggestions; other than to use Buddy API's baOpenFile() method to open your PDF in its associated application, or buy a copy of INM's Impressario xtra to host it on the stage via a self-contained Director xtra that doesn't require Acrobat/Reader to be installed (très expensive unless you use it on numerous projects)

                    • 7. Re: Veiwing a PDf using Activex Direct to stage
                      Mark A. Boyd Level 4

                      (I dont know why you couldn't download the other attachment, it just says it's queued?


                      There seems to be a (hopefully temprorary) problem with the length of time files spend in the virus checker queue. Rather than attach, use the camera icon.

                       

                      camera.png

                       

                       

                      --
                      Mark A. Boyd
                      Keep-On-Learnin' :-)

                      • 8. Re: Veiwing a PDf using Activex Direct to stage
                        The-Face Level 1

                        I just ended up purchasing PDFxtra (which has it's own issue of giving an error if the end user has installed acrobat reader, then updated it without uninstalling the old version) and it seems to work ok so far aside from that quirk I can't seem to figure out.