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.
Hi Thom,
I appreciate you making the time to respond.
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-
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.
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
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
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
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
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.
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);
and
(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-
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-
DONE !!!
Many thanks to Dr. D.P. Story ret. for his guidance with my project.
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
North America
Europe, Middle East and Africa
Asia Pacific