1 2 Previous Next 56 Replies Latest reply: Jul 19, 2012 11:59 AM by DaLe Zki Go to original post RSS
      • 40. Re: FlashVars pass field text to swf
        Thom Parker CommunityMVP

        Hi Dale,

           I have received the messages, but I have not been keeping up with code you are testing, and don't have much to say.

         

        However, it looks like Joel is trying to get you to do a little debug with some test scripts.  This is exactly what I would do. 

         

        This code:

            this.myField.text = ExternalInterface.call("eval","this.getField('fname').value");

         

        is what you should be working on. First, verify that you can get the Flash side working.  Create an app with with one button and one text field

         

        Put this code in the button click.

         

        this.myField.text = "Hello"

         

        if this works inside the Rich Media annot, then add the ExternalInterface call.   Use a try/catch to report any errors in the flash code.

         

        Then make sure that this code will run from a button inside the PDF

         

        console.println(this.getField('fname').value);

         

        This tells you that the getField is working. If it is then you are ready to test the whole thing.

        You just have to make sure each part is working properly.

        • 41. Re: FlashVars pass field text to swf
          DaLe Zki Community Member

          Hi Thom,

          I appreciate you making the time to respond.

           

          • The creation of a Button in the SWF and "Hello" test worked well.
          • The SWF inserted in the PDF, with "Hello" test worked as well.
          • Acrobat side: The .getField test ...console.println read the PDF textField just fine

           

           

          Your article on "Exception Handling in Acrobat JavaScript" was a helpful read..Thanks!

          http://acrobatusers.com/tutorials/print/js_exception_handling

           

          A reference Question,

          will the User will have to use two Buttons (one in the PDF and another in the RMA(SWF)?

           

          With no errors being thrown, the two are still not interfacing?

          (see current, detailed code in above post)

           

          I'll keep testing / try/catching.....

          D-

          • 42. Re: FlashVars pass field text to swf
            Joel_Geraci

            Now that I have my internet back up and running....

             

            I think it's time for an article on this topic. I'll try to put one together with both a Flash Pro and a Flash Builder project example.

             

            Could take a week or so.

             

            J-

            • 43. Re: FlashVars pass field text to swf
              DaLe Zki Community Member

              Sounds great Joel....

              I can't wait to have a solution.

               

              Per my recent post (#38 above),

              I feel I am getting closer.

               

              As you compose your article,

              please consider an example of 'multiple' text field transfers into the RMA.

               

              Many thanks!

               

              D-

              • 44. Re: FlashVars pass field text to swf
                DaLe Zki Community Member

                Hi Joel

                 

                I thought I would check in and see if you are still considering

                a few Project examples ( PDF and RMA/SFW text interface).

                 

                I am eager to see understand where I went astray.

                 

                Thanks in advance for your time putting these Flash Pro and Flash Builder examples together.

                 

                D-

                • 45. Re: FlashVars pass field text to swf
                  Dave Merchant CommunityMVP

                  I've posted a PDF containing a test suite we use.

                   

                  It's a simple SWF file which runs generic "eval" commands, either in response to a button pressed on the SWF or by triggering a callAS() command from the PDF. The AS3 code is in a file attachment so you can see the general concepts.

                  • 46. Re: FlashVars pass field text to swf
                    Joel_Geraci Community Member

                    Again, paid work has gotten in the way of my blogging but I should have the example and explanation up soon. In the mean time, look at Dave's example.

                     

                    J-

                    • 47. Re: FlashVars pass field text to swf
                      DaLe Zki Community Member

                      Dave & Joel,

                      Thank you for your time with this niche project.

                       

                      update.. v3 (April 14, 2012)

                       

                      Hi Dave ( Joel & Thom)

                       

                      Before I consider putting this code challenge out for a bid (small request as it may be),

                       

                      I was wondering if you have an ETA on when you might have your Examples available.

                       

                      There is a deadline to use this code coming up,

                      and there are no current examples I can frind ( with both

                      PDF and SWF reference) that I can reverse engineer.

                       

                      Thanks in advance for your persistent coaching.....

                       

                      Dale

                      dzki@aol.com

                       

                       

                       

                      update..v2 (April 11, 2012)

                       

                      Hi Joel,

                      Your PDF AcroJS helped validate I was on the right path.

                       

                      If you are able and willing,

                      I would welcome viewing the SWF AS3 side of your example.

                      (just the AS, I won't need anything on your SWF's stage)

                       

                      It's evident I am missing a few more pieces this puzzle......

                      If you you can't, I understand. Dad said, it never hurts to just ask.

                       

                      Thanks again..

                       

                      D-

                       

                      update...v1  (April 6, 2012)

                       

                      ..spent the afternoon with attempts but can't get the RMA to grab the PDF form field.

                       

                      PDF side;

                      the AcroJScript, when tested using the ' console.println...', reports the TextField (fname) just fine.

                       

                      ref;

                      TextField name = fname

                      Button name = play

                       

                      here's my complete, updated Button's script (retyped here);

                       

                      var RMA = this.getAnnotsRichMedia(0)[0];

                      RMA.callAS("swfPdf", this.getField('fname').value);

                       

                      console.println(this.getField('fname').value);

                       

                       

                      SWF side;

                       

                      When the SWF movie is tested there are no Output or Compiler errors.

                       

                      ref;

                      TextField name = namehere

                       

                      here is my complete, updated AS3 (retyped here);

                       

                      import flash.external.ExternalInterface;

                       

                      ExternalInterface.addCallback("swfPdf", fillText);

                       

                      function fillText(fname):void

                           {

                                this.namehere.text = this.ExternalInterface.call('eval', "this.getField('fname').value");

                           }

                       

                      ~ ~ ~

                      I attempted the SWF Button method and the movie tested without errors using 'trace statments'.

                      Yet, when added to PDF as an RMA did not interact (see post #38 for code)

                       

                      When you have a moment, I would sure appreciate your guidance..... Thanks again......

                       

                      Dale

                      • 48. Re: FlashVars pass field text to swf
                        DaLe Zki Community Member

                        Hi Joel,

                        RE: posting to "The PDF Developer Junkie Web and Blog" ~

                         

                        Understandably 'paid work' is the priority.

                         

                        I thought I would check in to see if you have a 'Hope-to-post-by" date for your examples.

                         

                        I explored Dave's great example, yet, without the SWF/FLA side,

                        the reverse engineering was a challenge.

                         

                        As you can tell,

                        I look forward to completing my learning how it's one.

                         

                        Thanks again for your time and assistance.

                         

                        Kind regards

                        Dale

                        • 49. Re: FlashVars pass field text to swf
                          Dave Merchant CommunityMVP

                          The AS3 code is in a text file attached to the PDF - click the paperclip icon on the sidebar.

                           

                          DaLe Zki wrote:


                          I explored Dave's great example, yet, without the SWF/FLA side,

                          the reverse engineering was a challenge.

                           

                          • 50. Re: FlashVars pass field text to swf
                            DaLe Zki Community Member

                            Thanks Dave,

                            Looking forward to explore this AS3 code.

                             

                            By the way, I have been enjoying your posts on the "Acrobat Ninja" site.

                            It's been insightful...

                             

                            again, I appreciate you making the time to help

                            novices get through the learning curve.

                             

                            D-

                            • 51. Re: FlashVars pass field text to swf
                              DaLe Zki Community Member

                              I have spent a view days reviewing the notes, links and tips within this thread.

                              Your USVAR example was a great study.

                               

                              And yet, I still cannot interface the PDF textField with

                              the SWF(RMA)'s dynamic textField.

                               

                              When you have a moment,

                              I could again, use your help.... for I am officially stuck!

                               

                              For clarity, I'll retype everything I've done, including tests I've run:

                               

                              Thanks in advance for helping me get this last leg of this quest:

                               

                               

                              Objective: push PDF form textFields into RMA(SWF) dynamic textFields

                               

                               

                              SWF side:

                              dynamic textField name: namehere

                              button: play_btn

                               

                              // the entire AS3 code exactly how I've have it my SWF;

                               

                              ExternalInterface.addCallback("swfPdf", fillText);

                               

                              function fillText():void

                                   {

                                        this.namehere.text = this.ExternalInterface.call("eval", "this.getField('fname').value");

                                   }

                               

                              // button added for testing purposes only

                               

                              play_btn.addEventListener(MouseEvent.Click, clickHandler);

                               

                              function clickHandler(event:MouseEvent):void

                                   {

                                        trace("Click");

                                        this.namehere.text = "Hello"

                                   }

                               

                              SWF notes....

                              No Errors thrown

                              "Click" appears in Output tab

                              "Hello" appears when button is MouseUp.

                               

                              "Hello" also works when the RMA is add to the PDF

                               

                               

                              PDF side

                              Form textField:  fname

                              button:  play

                              number of pages: just 1(one)

                               

                              code on button:

                               

                              var RMA = this.getAnnotsRichMedia(0)[0];

                              RMA.callAS("swfPdf", this.getField('fname').value);

                               

                              console.println(this.getField('fname').value);

                               

                              PDF notes...

                              using the script debugger

                              no errors were thrown

                              console successfully report text input into the textField 'fname'

                              ~~~~

                               

                              That's the entire code on both sides.

                              ~~~~

                              After this is done, I'll work on an interface w/ Multiple exchanges......

                               

                              Thanks again Dave (Joel / Thom)

                               

                              Dale

                              • 52. Re: FlashVars pass field text to swf
                                DaLe Zki Community Member

                                While I know I am getting closer to a solution,

                                I would welcome some feedback on the Post #51....

                                 

                                Thanks in advance for your time and expertise.

                                 

                                Dale

                                Fremont, CA

                                • 53. Re: FlashVars pass field text to swf
                                  DaLe Zki Community Member

                                  Working again on using Dave's script last night, I know I am getting closer.

                                   

                                  At the risk of being an over eager,

                                  I'd welcome a solution, and some notes where I went wrong.

                                   

                                  Thanks again.... I have indeed learned a lot from all of you along the way.

                                   

                                  Kind regards,

                                  Dale

                                  • 54. Re: FlashVars pass field text to swf
                                    DaLe Zki Community Member

                                    Recently used an example from the AS3 reference webpage.

                                    While it focused on an interface with a HTML page, it was a good resource just the same.

                                     

                                    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/External Interface.html

                                     

                                    Still, I remain stuck......

                                    the latest attempt is very similar to post #51 above

                                     

                                    Should anyone know of a working solution /example,

                                    I would very much appreciate this resource.

                                     

                                    Objective: Multiple textField exchanges between,

                                    "pushing" the text from the PDF into the SWF(RMA);

                                     

                                    • Acrobat PDF (form fields); using acrojs

                                         and

                                    • Flash textFields; using AS3

                                     

                                         (currently assuming dynamic fields.. not input fields)

                                     

                                    Software: Acrobat X Pro  &   CS5.5 FLASH Pro

                                     

                                    Thank you in advance for all your input thus far...... and am very much looking

                                    forward to solving my coding interface challenge.

                                     

                                    D-

                                    • 55. Re: FlashVars pass field text to swf
                                      DaLe Zki Community Member

                                      Hi Dave,

                                      Thank you for your usvar PDF example:

                                      I have been using it to attempt a solution for this interface.

                                       

                                      I modified the 'acrojs' code to reflect "this.getField('field1').value" .

                                      Then studied and tweeked your AS3 code......

                                       

                                      In the AS# code " // workaround to append...." ,

                                      I receive an error the the ' tfl:TextArea ' was not found...

                                       

                                      In an attempt to recreate your usvar SWF, I created the following "dynamic" text fields;

                                      evalText, replyText and infoText

                                      and a button = butEval

                                       

                                      under the function eiCall, I adjust the ExternalInterface to ("eval", "this.getField('field1'),value");

                                       

                                      With some trial an errors, I am still unable to Interface the PDF to the RMA.....

                                       

                                      I would welcome your feedback.......

                                      as a reference ( at the end of this project) there will be multiple fields being pushed from the PDF into the RMA(SWF).

                                       

                                      Thanks for your time.....

                                       

                                      D-

                                      • 56. Re: FlashVars pass field text to swf
                                        DaLe Zki Community Member

                                        DONE !!!

                                         

                                        Many thanks to Dr. D.P. Story ret. for his guidance with my project.

                                        http://www.acrotex.net/

                                         

                                        Also, thanks to the great coaches in the above thread;

                                         

                                        ~~~

                                        PDF to SWF(RMA) interface

                                         

                                        The below script examples are set up for a two (2) text field exchange

                                         

                                        ~ ~ ~

                                         

                                        The Acrobat (PDF) side

                                        {using Acrobat X Pro}

                                         

                                        // insert these scripts below in a "Document Level"

                                        // insert the Multimedia RMA(SWF*) on page two (2)  {* upon final coding and publishing}

                                        // create two text Form fields [ textpdf_1 , textpdf_2 ]

                                         

                                        //  these scripts are currently set up to interact on the 2nd page of a PDF, edit according

                                        //  i.e.  Form text Fields and the Multimedia RMA(SWF) are on page two (2) of the PDF

                                         

                                        Document Level codes;

                                         

                                        // insert and label:  DocSWFScript

                                         

                                        var RMA = this.getAnnotsRichMedia(1)[0];

                                        RMA.activited=true;

                                        function populateSWFTextField(rm,fieldObj,fName)

                                             {

                                                  var v = fieldObj.value;

                                                  rm.calS("swfPdf", v, fName);

                                        }

                                         

                                        var aPage1Fields=new Array(

                                             ["textpdf_1","textswf_1"],

                                             ["textpdf_2","textswf_2"]

                                        )

                                         

                                        function getInputFields()

                                             {

                                              for (var i=0; i<aPage1Fields.length;i++)

                                                  {

                                                       var f=aPage1Fields[i];

                                                       var oField=this.getField(f[0]);

                                                       var swfFName=f[1];               

                                                       populateSWFTextField(RMA,oField,swfFName);

                                                  }

                                        }

                                         

                                        ~ ~ ~

                                         

                                        The Flash side ~ AS3

                                        (using CS5.5)

                                         

                                        // on the Stage, create two, receinving "dynamic" text fields [  textswf_1, textswf_2  ]

                                         

                                        // in an AcrionScript layer place this code

                                        // save, publish, then insert as a Multimedia (RMA) within the PDF you just edited above

                                         

                                        AS3 code;

                                        ~ ~

                                         

                                        import flash.external.ExternalInterface;

                                         

                                        ExternalInterface.addCallback("swfPdf", fillText);

                                         

                                        // the fillText function has two arguments, the value and the field the value populates

                                         

                                        function fillText(v:String, fName:String):void

                                             {

                                                  this[fName].text = v;

                                        }

                                         

                                        ~ ~ ~

                                         

                                        I will post a link to my final project in the next week or so (Aug 2012)

                                         

                                        "Play it Forward"

                                         

                                        Thanks

                                        Dale

                                         

                                        Full updated script was edited by: DaLe Zki

                                        1 2 Previous Next