ExternalInterface.call Acrobat 9
I am having trouble with this script. I can not get it to
pick up text from the pdf. Not sure if the problem is on the Java
side or the AS side but I think the AS2.0.
Acrobat 9
/* JavaScript */
var GuestNamez = this.getField("TestText");
// Get hold of the first Flash object on the second page
var annot = getAnnotsRichMedia(0)[1];
if ( annot )
// if exists, call the function called "GuestNam"
// and pass an item ID as an argument
annot.callAS( "GuestNam", GuestNamez.value);
Flash
/* ActionScript 2.0*/
import flash.external.*;
var realFunction:Function = setState;
ExternalInterface.addCallback("GuestNam", null,
realFunction);
function setState(stateData:String):Void {
GuestsNames.text = stateData;
Any help would be great thanks.
You might want to look in or ask in the Acrobat SDK forum.
Similar Messages
-
ExternalInterface.call problem with object-orientation
Hi
I am using an swf inside a PDF. In a PDF-context the ExternalInterface-class works much the same as it does within a website. So far calling a function in the document-script works.
The thing now is, that I really try to use an object-oriented approach as often as I can. In this case I have a function I could call using
var jsCaller:Object = ExternalInterface.call("myFunction",parameters);
This works as expected.
However, I have now made that function a method in an object, so I can access it within JS using dot-notation: myCoolObject.myFunction(); This works as well, so the problem is not the function itself. However, the call
var jsCaller:Object = ExternalInterface.call("myCoolObject.myFunction",parameters);
does not work.
This means there's either something I'm missing, or it's a limitation of ExternalInterface, or it's a limitation of externalInterface in a pdf-context.
Anyone to enlighten me?If EI calls eval it should be able to resolve the object-path. However, this doesn't seem to be the case. Also note that my parameter is an array, so this probably wouldn't work, even if the syntax did.
Anyway, I tested your syntax in my PDF, and it showed the same behaviour as before (i.e. the function in which the EI-call was placed could not be executed, and acrobat claimed there was no such function). It didn't work with my normal function, and not even with a simple console.println-statement that way. So in PDFs it definitely doesn't work like that.
But thanks for the suggestion! -
ExternalInterface.call problem calling Javascript
I can't get work my SWF calling a javascript function in my
web page (ASPX)
this is the code that i use to show the SWF :
function RunClip(idMap)
var Larghezza = 1024;
var Altezza = 768;
var clip = "supervisore.swf?idMap="+idMap;
var allowScriptAccess = "always";
var allowNetworking = "all";
document.write("<DIV id=\"flash\"
style=\"z-index:2\">");
document.write("<object name=\"flashObject\"
classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" "+
" codebase=\"
http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"
"+
" width=\""+Larghezza+"\" height=\""+Altezza+"\"
align=\"middle\">");
document.write("<param name=\"allowScriptAccess\"
value=\""+allowScriptAccess+"\" />");
document.write("<param name=\"allowNetworking\"
value=\""+allowNetworking+"\" />");
document.write("<param name=\"movie\"
value=\""+clip+"\"/>");
document.write("<param name=\"quality\"
value=\"high\"/>");
document.write("<param name=\"wmode\"
value=\"opaque\"/>");
document.write("<embed src=\""+clip+"\" quality=\"high\"
width=\""+Larghezza+"\" height=\""+Altezza+"\" "+
" align=\"middle\" play=\"true\" loop=\"false\" "+
" type=\"application/x-shockwave-flash\" quality=\"high\" "+
" allowNetworking=\""+allowNetworking+"\" "+
" allowScriptAccess=\""+allowScriptAccess+"\" "+
" pluginspage=\"
http://www.macromedia.com/go/getflashplayer\"
/>");
document.write("</object></DIV>");
THIS IS ACTIONSCRIPT (title is always 'null')
var title:String =
ExternalInterface.call("JsFunction","test");
THIS IS THE JAVASCRIPT function
<head runat="server">
<title>Test</title>
<script language=javascript>
function JsFunction(variable) {
return variable;
</script>.....
<body onload="hide();" onclick="hidemenu();">
<form id="form1" runat="server">
<DIV id="outer" style="z-index:1">
<script
type="text/javascript">RunClip(1);</script>
</DIV>......If EI calls eval it should be able to resolve the object-path. However, this doesn't seem to be the case. Also note that my parameter is an array, so this probably wouldn't work, even if the syntax did.
Anyway, I tested your syntax in my PDF, and it showed the same behaviour as before (i.e. the function in which the EI-call was placed could not be executed, and acrobat claimed there was no such function). It didn't work with my normal function, and not even with a simple console.println-statement that way. So in PDFs it definitely doesn't work like that.
But thanks for the suggestion! -
Problem with ExternalInterface.call and Internet Explorer
Hi, I´m developing a site, (
www.gen-studio.com/avelart2
), and I´m using a swf to display a set of thumbs that when
clicked show an item and its description on the browser, those
items might be images or video, everything works fine with the
images.
And actually it works fine with the videos too, when using
Firefox, but when I test the page on Internet explorer it just
doesn’t work!
On principle let me describe how it´s supposed to work,
a thumbnail when clicked sends an id number to javaScript using
ExternalInterface.call(“myFunction”,myId); -I´m
using AS3 for the swf´s-
the javaScript file has already loaded (ever since$(
document).ready) a XML file which uses to match the id with a file
and the description, if the item to show it´s a video, then it
creates a variable which holds a string with the proper html to
embed a swf (a swf movie player that resides just next to the HTML
file), when loaded, the swf movie player uses
ExternalInterface.call() to ask for the source of the video that
has to play, and that function is as follows:
setVideo: function(){
alert("hola");
return comun.miVideo;
(The alert(“hola”); is just to test that the
function is being called), which it is, but it returns null as a
value instead of the proper string, and this happens only on
internet Explorer, but works correctly on Firefox.
I´ve been reading all day about the subject and found a
few interesting things, which though have made me narrow my
problem, they haven´t just provided me with a solution, what I
found so far:
-I must have in account flash security issues: Checked (my
actionScript follows:)
import fl.video.*;
import flash.external.ExternalInterface;
flash.system.Security.allowDomain("*");
var vid:FLVPlayback = this.miPlayer;
vid.source =
flash.external.ExternalInterface.call("comun.setVideo");
-ExternalInterface and Internet explorer don´t work
properly when tested locally: Checked (I have a server on my PC and
I´m testing the site as well in the above direction).
-The object tag holding the swf must have a proper id
attribute: Checked.
-It´s super important the way the object tag is formed:
Checked, and I also tested the tag separately (I put it directly in
the HTML instead of adding it via javaScript) and it worked as
expected in both Firefox and Internet Explorer, which leads me to
believe:
-I read somewhere that if you add the object tag by using
innerHTML or appendChild, returning values from javaScript to swf
won´t work, but I couldn´t find an explanation nor a
solution.
Well, as I said now I´ve been looking all day for an
answer, so I really hope you can help me or give me some advice on
the subject, thank you so much for your time!Hi! it solved itself !! (nahh, I wish), but it indeed had a
solution, it was something quite simple, and I don´t really
understand why it was not working in the first place, but here is
the thing:
I´m learning jquery and this is the first proyect
I´m officially using it, so I was using
$('#myDIV').append("string"); to embed the swf, (and it was working
perfectly on Firefox), so since I had narrowed my problem to those
lines, I decided to try some good-old-fashioned-javaScript and
changed it for: var myDiv =
document.getElementById('thatParticularDiv'); myDiv.innerHTML =
('string'); and it worked both in Firefox and IE !!!!!! :)
I´m quite happy about it, and if someone knows
what´s the issue with my jquery approach I would love to hear
it. THANKS !! -
ExternalInterface.call not working
***Flash CS4 -published to AS3.0 and Player 10***
I am having a problem using ExternalInterface.call to a javascript function. I have used this method many times in many places and at some point during this project, it was working, but now it stalls my Flash file when executed.
I have the function:
var initialize=function(){
ExternalInterface.call("SCOInitialize");
statusTxt.text="initializing";
On my html page, there is a SCOInitialize function that works perfectly if I call it via the html page:
<body onLoad="SCOInitialize()">
</body>
When I make the call using flash...
initialize();
...the Flash file just gets hung up and it actually wont execute the second line of code in the function: statusTxt.text="initializing";
What is the deal? I can't for the life of me figure out why it won't work anymore!!!
Also, I have checked to see if the ExternalInterface is available, and it returns "true".I am testing locally using an HTML file that virtualizes an LMS. I have used is many times in the past. I originally used javascript that I normally create for these circumstances that always worked in the past, then switched to trying to use the Javascript that Flash created. In either case, the call to the Initialization function onLoad from the HTML page itself worked fine, both actually having different Function names, but perform the same function, while the ExternalInterface call to both fails.
-
ExternalInterface Call Javascript Array to AS2 throwing undefined error
I need to pass various (tracking) IDs to a .swf. the IDs are in an array like this =
<script type="text/javascript">
function getImpID() {
var medID={impID:'12345',pvID:'677890',exID:'654332'};
return medID;
function thisMovie(banner) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[banner]
else {
return document[banner]
window.onload=getImpID;
</script>
Right now the AS2 I have is:
import flash.external.*;
System.security.allowDomain(sourceDomain)
var allID:String = ExternalInterface.call.apply("getImpID");
function getIDs(){
var impID:Number;
var pvID:Number;
var exID:Number;
var id_arr:Array = allID.split(",");
_root.id_test.text = impID;
getIDs();
Basically what I need is to split the three ID's from the javascript so that I can append them with various URL clickTags in the AS. Main issue I have is the 'undefined' error, so I'm going out on a limb here that the AS2 I have doesn't do anything right now of value. Biggest head scratcher for me is, if I have the IDs in an array in the javascript (medID) how to get them not only properly into Flash but to separate them into their separate IDs.
Any suggestions would be greatly appreciated.
Thanks!Forgot to reply, your guidance helped in solving the riddle =
actionscript:
function idTag(){
getID = Object(ExternalInterface.call("getImpID"));
getID.toString();
//_root.id_test.text = getID;
idTag();
javascript
<script type="text/javascript">
function getImpID() {
var getID=['impID=8910424942498409873&pvID=8910423767061585831'];
thisMovie("banner").getID;
return getID;
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
else {
return document[movieName]
</script>
worked like a charm! -
ExternalInterface.call('scroll',0,0) not working in chrome
My application has a requirement that if the user is in the bottom of the page and clicks on any link which in turn opens a flex popup, it will take the user to the top of the application as popup opens on the top (as per requirement). For this i have used ExternalInterface.call('scroll',0,0); which works perfectly for every browser except google chrome. in chrome when user clicks it takes the user to the top but doesnt opens any popup, once user clicks on browser scrollbar and moves slightly then the pop up opens.
Need a solution for this.
Thanks in advance.Maybe chrome needs to get focus, if so instead of calling the scroll call
another JS function which scrolls and sets the focus on some html element in
the browser. Not sure if it will work but you can give it a try.
C -
Problem with AS3 "ExternalInterface.call" in InternetExplorer
Hi,
Explaining how the page is setup:
I have a HTML page with 2 different AS3 Flash movies.
The first flash movie is the main animation and sits in the
middle of the screen with a large background image set into the
body of the HTML.
The second flash movie stretches 100% width/height of the
screen dimensions and acts as a fade from black>to invisible.
What I'm trying to do:
Once the second Flash animation has faded from black to
invisible it calls a JavaScript function in the HTML page to hide
the div element the second flash movie is embed into (this is
because the first flash movie will display a set of input boxes
which the user needs to be able to type into - which they wont be
able to click on if there is another flash movie overlaying the
entire first movie).
My intial solution:
In the second Flash movie is the following code:
stop();
// this will load the API necessary to communicate with
external entities
import flash.external.ExternalInterface;
// call the JavaScript function
ExternalInterface.call('myJavaScriptFunction');
...and this works fine in Mozilla Firefox/Safari. The
actionscript successfully calls the JavaScript function in the HTML
page and that JavaScript function simply (at this stage displays an
alert() message to show that it has been successfully called).
Problem with IE:
But, the moment I try this in Internet Explorer I don't get a
alert() message but a JavaScript error message that says:
Code: Select all
Line: 1
Char: 106
Error: 'null' is null or not an object
Code: 0
As you can expect I'm totally confused as to what the problem
could be.
This is really urgent as it's a live project that needs to
get completed immediately, so any help you may have would be
greatly appreciated!
Kind regards,
Mark.My guess is that its to do with your embedding code. Check a)
you have an id attribute assigned to the resulting object tag from
whatever embedding method you use and b) for good measure make sure
its unique in your html page.
Javascript needs to have a valid reference to return the
value from the javascript function back to flash. In my experience
IE is more sensitive to issues here.
If you get stuck post a test page somewhere.
Tools to use to help with javascript debugging and view the
html embed results (e.g. from swfobject or activecontent.js):
In firefox : Firebug
In IE: IE Developer Toolbar , Companion JS, and DebugBar are
all helpful and , combined, get close to Firebug. -
Problem Description:
korean character crash when using ExternalInterface.call(funcName, args)
funcName : alpha-numeric
args : include korean characters
Steps to Reproduce:
<flex source>
private function handleRequest(val):void {
ExternalInterface.call("processRequest", "가나다라");
<javascript source>
function processRequest(param) {
alert(param); //does not display korean characters
Actual Result:
媛€?섎떎??
Expected Result:
가나다라
Any Workarounds:
Nothing !!
OS : Windows7 Pro 64bit(korean)
Flex Builder : 3.0
Flash Player : 11.8.800.168 ActiveX
Browser : IE10
WAS : WebLogic 8.1, 12g, Tomcat 5,6,7
Chrome : 29.0.1547.66 m <== Good
FireFox : 23.0.1 <== GoodSame problem here! With the exact same version.
Problems on IE.
Chrome and FF OK -
Flash Player v. 9.0.115.0 broke my ExternalInterface.call
The latest version of Flash Player has obviously broken my
ExternalInterface.call, which works for all previous versions. I
know that there are security changes in the latest version but by
using the debugger provided it did not kick out any problems. By
reading the
article
about the security changes, I couldn't find anything useful in
to solve this.
Please help me!
Backend:
import flash.external.ExternalInterface;
private function getData():Void {
if (ExternalInterface.available) {
try {
this.args = ExternalInterface.call("passData");
output.text = "Values from ExternalInterface: "+this.args;
} catch (e) {
output.text = "A Security Error occurred : "+e.message+"\n";
} else {
output.text = "External interface is not available for this
container.";
Front end
<script type="text/javascript" language="javascript">
function passData(){
var args = new Object();
args.something1= 466;
args.something2= 466;
return args;
</script>
Output text on v.115 : Values from ExternalInterface:null
Output text on pervious versions: Values from
ExternalInterface: [Object]
It is working perfectly fine in previous versions of Flash
player, but after I upgraded to the latest version 9.0.115.0 the
ExternalInterface returns null, I tested in other previous versions
and it returns the object pass from the Javascript ok. Surely it is
something to do with the latest version, it could be the security
changes but I have no idea how to fix this and this is driving me
crazy! : (
Any heros could help me please? Thanks in advance!
JenPlease continue to work with your support agent on this one..
Also, please read:
"Security changes in Flash Player 9"
http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html
That should give you an understanding of the changes. -
ExternalInterface.call Causes JAVASCRIPT ERROR??
my AS3.0 is this:
btn_mc.addEventListener(MouseEvent.CLICK,journey_popup);
function journey_popup(e) {
ExternalInterface.call("journey_wow_popup");
my javascript is this:
function journey_wow_popup () {
window.open('journey_pricing.php','_blank',
'height=200,width=350,status=yes,toolbar=no,menubar=no,location=no');
My flash OBJET ID and movie name is "journey_wow"
I get this javascript error when I click btn:
Error: "journey_wow" is undefined
I tried this on 4 computers, I never get the the error in FF,
I got the error on 2/4 of the computers in IE and didnt get the
Error in the other 2.
So sometimes it works in IE and sometimes it doesn't. Also my
flash element is not in a form.
you can view it here:
http://www.sussexjewelers.com/product.php?pid=1390
(its the big red box with yellow star)
Please help!!
Thanks!Below is my embeding script, thanks.
<script language="javascript">AC_FL_RunContent =
0;</script>
<script src="AC_RunActiveContent.js"
language="javascript"></script>
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', '
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '626',
'height', '115',
'src', 'journey_wow',
'quality', 'high',
'FlashVars',
'journey_price=<?=round($prod_field['prod_price'][0])?>',
'pluginspage', '
http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'journey_wow',
'bgcolor', '#ffffff',
'name', 'journey_wow',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', 'journey_wow',
'salign', ''
); //end AC code
</script> -
Hi,
I want to check how ExternalInterface.call works.
Following is the as3 code for that.
ExternalInterface.call("TestExternalInterface ", "some new text variable");
Here is the javascript function.
function TestExternalInterface (data)
alert(data);
But I don't understand how these two codes interact with each other. As an example whether this ExternalInterface.call works with a button click in SWF file or at the time of loading SWF file into web page. All the articcle I went through, talks about javascript function and actionscript code, but the initialization of the interaction between these two files is not clear for me. I really appreciate if someone can tell me the missing part of this.
Thank you.I'm sorry for posting codes from two different cases. Since my fiirst attempt didn't work, I started created the html page and as3 file gain with different javascript function name.
Here is the javascript function:
<script language="javascript">
function myJavascriptFunction (data)
alert(data);
</script>
And following is the as3 contnents:
btnGo.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
ExternalInterface.call("myJavascriptFunction", "some new text variable");
The link you've given functions exactly as I wanted. Can you please check the above code and tell me what's wrong with that. If you want I can send you the files, but I didn't find a way to attach files to the post. Anyway thanks for your reply. -
ExternalInterface.call URL string limit
I am using ExternalInterface.call and i found out that
recursive calling will not work .........and passing all the data
in one call
is also giving me a problem with string limits...........ANY
IDEAS please?Yes. Make a function in JavaScript that uses the
"GetVariable" method.
(READ HERE:
http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03. html
...and call it from the external interface. Put your 'string
data content' in a variable and read it from JavaScript. -
AS 3.0 - using ExternalInterface.call to open a .pdf
Hi - using Flash - AS 3.0:
I am trying to use ExternalInterface.call to open a .pdf file - but it is not working - nothing is happening...
ExternalInterface.call ("window.open","diagrams/v1/crh.pdf", "WindowName", params);
but this line DOES work - call an .html file to open.
ExternalInterface.call ("window.open","m5_quiz/v1/quiz.html", "WindowName", params);
I can't find any information that says this should or shouldn't work - it seems to me it should open it.
To get around this - I have been using 'navigateToURL' to open the pdf file - but that triggers the pop-up blocker - using the External Interface call does not.
Any help/ideas?
Thanks,
LisaI agree - that code - if it opens an html should open a pdf - but it doesn't. And I don't know why..
Why is the code screwy? Could I do it better another way?
Thanks -
ExternalInterface.call String parameter length limit???
Is there a String length limit to the amount of chars a
String can contain when passed as a parameter to
ExternalInterface.call()?
Also, are there any chars that ExternalInterface.call()
cannot serialize in a string?? Like \n, \t ...etc.
The livedocs don't answer these questions.thanks for your reply but i just figured it out.
ExternalInterface.call("jsFunc", longString);
There is seems to be no char limit that i came across cause i
was able to shove 2K in there.
The problem is the newlines in the string, they must get
messed up during serialization. Just make sure you clean the string
of newlines like so:
longString = longString.split("\r").join("
").split("\n").join(" ");
ExternalInterface.call("jsFunc", longString);
works fine......
Maybe you are looking for
-
Songs can't be accessed because apple ID no longer accessible
I have songs that I purchased a long, long time ago. They are so old they were purchased from an Apple ID and email that no longer exists. How can I access these songs?
-
Create summary file as part of export and send with photos via ftp?
I've looked this forum quite a bit tonight, but I'm under a tight deadline, so I'm going ahead and posting. Excuse me if I'm asking something that is answered elsewhere in the forum. I need to add a step to a custom FTP export plugin that will gener
-
Hello Gurus, I am having a small problem while printing the smartform. I wan to display a link in the smart form with tilte. Example Link : www.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.com But it is displaying like
-
Our company purchased this product in 2008. We don't have the budget to upgrade at this time - but the installation DVD has become unreadable (Application Data DVD for Windows). I have the receipt /Invoice from CDW and a License key. Is there any way
-
HT201365 Don't like os7 on my ipad,how can I go back to 6.3os
Don't like the new upgrade os7 on my ipad slow eveything down don't know how to close apps to save battery life can I go back to os6.4?