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!
Similar Messages
-
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! -
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 !! -
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. -
Calling Javascript by ExternalInterface advances playhead?
HI,
I'd like to call Javascript function by ExternalInterface while a flash movie is playing. I actually could call a function but the movie looked faster than the expected framerate. It looked like the playhead advanced everytime I called the function.
After some trials, it seems like...
Playheads in all MovieClips advances when I call Javascript function by ExternalInterface.call().
The playhead advances only while the movie clip is playing. Once it is stopped, it'll not be advanced until it is played again.
I made an simple example and attached it to this post so that you can see what I mean.
The attached file contains an fla file which counts up number from 1 to 5 and is played at 0.5 fps, that is, moves to the next frame every 2 seconds. And there is a button titled "Call JS" which calls a blank Javascript function, which does nothing. If you open the html file, you'll see the number counted up slowly but advanced by one or two frames when you click the button.
Please look at the first frame of 'action' layer and the js file, if you'd like to see what I did for this with ActionScript and Javascript. You'll see the number not counted up even when you click the button, as I mentioned above, if you add stop(); at the end of the AS code.
I'm using Flash CS4 on Mac OS X 10.6. The web browsers are Safari 4.0.4 and Firefox 3.6, and the version of flash player is MAC 10.0.45.2.
I wonder I'm doing anything wrong or this is the way I shouldn't do. Has anyone experienced something like this?
Any help will be much appreciated. Thanks in advance.i don't see a problem except the op seems confused. i'm not sure why (or even if) he expects the playhead to stop when there's no code to stop it.
anyway,
1. the attached files contain no stop(). once added, the playhead stops, as expected.
2. there's no doNothing js function. once added, it executes, as expected.
3. the attached files behave, as expected. -
Java Applet call javascript problem
Hi I have a web page as follow and embedded a applet. The applet call the java script, and instead of showing an alarm, the browser show the javascript code. Is that strange ? Any suggestion for this problem.
HTML:
================================================================
<HTML>
<HEAD>
function ShowEmbd()
alert("Test Applet call Javascript");
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="AppletEmbdStart">
<OBJECT classid="clsid:48B2DD7B-6B52-4DB0-97C9-ECB940113B47" id="CIVON_DEmbdObj" width="0" height="0"></OBJECT>
<APPLET code="MyApplet.class" width="0" height="0"></APPLET>
</FORM>
</BODY>
</HTML>MyApplet.java
=========================================================================
import netscape.javascript.*;
public class MyApplet extends javax.swing.JApplet
private JSObject m_win = null;
private JSObject m_doc = null;
public void init()
getJSWin().call("ShowEmbd", null);
private getJSDoc()
if(m_doc == bull)
m_doc = (JSObject) getJSWin().getMember("document");
return m_doc;
private JSObject getJSWin()
if (m_win == null)
m_win = netscape.javascript.JSObject.getWindow(this);
return m_win;
}The page was load and it should call the applet MyApplet. The MyApplet should do the init() method and call the Javascript "ShowEmbd()", BUT, instead of show alert from ShowEmbd(), the browser show the code of ShowEmbd() itself ...... It did not run the javascript and shows the alert ??
The browser shows a message from status bar "The applet not initial" ???? why ???
Can anyone help ?!On first look:
I am not sure about the Object Tag, but the Applet Tag requires the MAYSCRIPT attribute before Java can call Javascript. -
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 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> -
ExternalInterface.call() problem
Hi,
My first problem was the random activation of the pop up
blocker in Fierfox when I use navigateToURL("url", "_blank").
I found a solution
there,
but unfortunaly this solution didn't work for me.
The solution is to use ExternalInterface.call for opening a
new window without the popup blocker, but I cannot use the solution
if I don't put in my HTML page <param name="allowScriptAccess"
value="always" />. If I don't put this parametre I cannot use
ExternalInterface.call.
You'll say, why you don't put this parametre? It's because a
lot of person use this application, and they are able to integrate
it into there web site, unfortunaly I cannot control if they put
the parametre allowScriptAccess.
So I'd like to know if it's possible to use
ExternalInterface.call without the parametre.
Thanks
Matthieuquote:
Originally posted by:
mattL_75_13
Nobody has an axe of search ??
I will trade you for a Sword of Reply -
Calling javascript with ExternalInterface in Flash 8
Guys,
I have a flash movie with a button. When the user clicks the
button I would like the movie to call a javascript function in the
host page. I have the button on screen. The timeline section shows
the 'up', 'over', 'down' and 'hit' states, then in the middle is an
image of the button. I click on it and in the box below I enter the
following:
quote:
import flash.external.ExternalInterface;
function dosomething():Void {
ExternalInterface.call("foo");
button_blip.addEventListener("click",
mx.utils.Delegate.create(this, dosomething));
At this stage, I just want to see a javascript alert to show
that this is working, but at the moment nothing happens at all..
the javascript function in the host document looks like this:
quote:
<script language="javascript">
function foo(){
alert("abababab");
</script>
Can anybody spot what's missing here? I'm using Flash 8 which
comes with the ExternalInterface API rather than the apparently bad
and buggy fscommand in earlier flash versions.
thanks
christo
note:
I have since moved that bit of actionscript to the first
frame of that layer in the main movie screen - because the AS
debugger said that it has to be on a clip event - the end result
however is no different.if I understand correctly you need to import the external
API.
import.flash.external.*;
the calls to the api are only available within the timeline
frame in which the above code exists .. -
Using AS2 to Call JavaScript w/ External Interface: What Am I Doing Wrong?
I am trying to trigger a JavaScript fuction from inside a
Flash 8/AS2 movie created by my coworker. The JS function is called
disappear(), which is meant to close the DIV that contains the
flash movie itself.
I know the JS works in all my target browsers - it's been
tested already. Now I need working ActionScript. The ActionScript
I've been studying is 3.0 so the fact that this task must be
accomplished in AS2 makes it that much harder for me; I know very
little about the way Flash Virtual Machine 1 works so I don't know
where to begin with the code.
I would like to implement this one of two ways:
Preferred Method: I'd like to create an AS file that I can
send to my coworker for inclusion in his FLA along with any code
necessary for linking the button instance to the class in the AS
file (don't think code is necessary; linkage done during
right-click on library panel, right?)
Alternative Method: I'd like to send my coworker text that he
can simply drop into the first frame in the movie to make it go.
I started out trying to call the javascript with on(press) {
getURL("avascript:myFunction"); }, which worked in Firefox but not
in IE6 or 7. Then I read over the tutorial here:
http://www.adobe.com/devnet/flash/articles/external_interface_print.html
and switched to using ExternalInterface.call() instead. That's
where I am now. My brain is hurting trying to dig up answers for
AS2 without reference materials... You are my best hope.
Please help me make sense of this ActionScript 2.0 code with
one of the prefered methods above. I am away from my copy of Flash
8 - I'm using FlashDevelop here at work - so I'd appeciate if you
could test any suggestions you make before you make them - unless
you are a Flash genius who I should not be questioning :) I've
provided the HTML/JS code; all you have to do is make a 500x300 SWF
and put a button instance in it.
----------------------------------------The attempt at
ActionScript 2.0 (don't
laugh)----------------------------------------
import.flash.external.ExternalInterface;
class JsCallerButton {
private var _caller_btn:Button;
//Constructor
public function jsCallerButton():Void {
this._caller_btn:Button = new Button();
this._caller_btn.addEventListener("click", clickHandler);
//Event handler for event set in class constructor
function clickHandler(eventObj:Object):Void {
ExternalInterface.call("disappear");
----------------------------------------The
HTML/JavaScript----------------------------------------
<html>
<head>
<script>
var timeout;
function appear(){
var the_style = getStyle("floatingflash");
if (the_style) {
var current_top = parseInt(the_style.top);
var new_top = current_top + 5;
if (document.layers) {
the_style.top = new_top;
} else {
the_style.top = new_top + "px";
if (new_top < 150) {
the_timeout = setTimeout('appear();',10);
} // appear
function disappear() {
var the_style = getStyle("floatingflash");
the_style.display = 'none';
} // disappear
function getStyle(ref) {
if(document.getElementById &&
document.getElementById(ref)) {
return document.getElementById(ref).style;
} else if (document.all && document.all(ref)) {
return document.all(ref).style;
} else if (document.layers && document.layers[ref]) {
return document.layers[ref];
} else {
return false;
} // getStyle
</script>
<style>
#floatingflash {
position:absolute;
border:1px solid red;
background:white;
</style>
</head>
<body onload="appear();">
<div id="floatingflash"
style="top:-400px;left:-150px;margin-left:50%;">
<!--This 'X' link is for manual calls to the function that
should be triggered from inside Flash-->
<a href="javascript:disappear();">X</a>
<p> </p>
<p>
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="500" height="300" title="Hover Ad">
<param name="movie" value="
http://------------------------------/500x300.swf"
/>
<param name="quality" value="high" />
<embed src="500x300.swf" quality="high" pluginspage="
http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="500"
height="300"></embed>
</object>
</p>
<p><a
href="launch.html">Back</a></p>
</div>
</body>
</html>Thank you for your response. The drives are in fact different letters -- I changed the drive name to correspond the original drive letter...but that doesn't seem to have fixed the problem.
Where I seem to stand is:
Old computer (with iTunes library) + external hard drive (with iTunes music) work just fine.
New computer -- iTunes library copied from old computer, iTunes music folder identified in iTunes, but iTunes can't find the music.
At this point, am I better off starting from scratch with the new computer (in terms of installing iTunes and moving my library over from my old computer)?
And if so, what would be the best way to approach this?
Thanks much. -
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.
-
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 -
Embedded .swf's calling javascript from air container
1) I have an html/ajax air app version 1.5.1
2) This air app embeds .swf files from an external source / web server & plays the embdded .swf inside air.
3) The embedded .swf file has a button with an onClick event
function onClick(event:MouseEvent):void {
ExternalInterface.call("someJavascriptMethod()" );
4) The javascript method to be called is already parsed inside the containing Air app and is waiting to be triggered.
5) When the onClick is triggered, the following error is thrown.
Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX,
Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.
at Error$/throwError()
at flash.external::ExternalInterface$/call()
at stress_fla::MainTimeline/onClick()
6) On investigation I found on your livedoc's website that Air does not support the ExternalInterface.call method.
http://livedocs.adobe.com/labs/air/1/aslr/flash/external/ExternalInterface.html
Look for Note: Adobe AIR currently does not support the ExternalInterface class.
7) Does anyone here know how I can get an embbeded .swf file to call javascript methods in the containing air application? I have had a look at the getUrl method but this is now longer supported & even the FS command but still to no avail. I may have a work around by inserting a DOM element over the top of the embedded .swf but this is not an elegant solution & want the .swf to talk directly to the air app container.
All help & comments welcome
Thanks
Kyle
Additionally I have found
http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7ed4 .html
Using the Html Loader so that Actionscript can call/manipulate the dom objects. At first I was whopee but then I tried the examples listed in the help. The HTMLLoader class is only available in Air. When trying to use import flash.html.HTMLLoader; Flash C4 complains that the Definition cannot be found on compile time & therefore does not export my movie correctly. Has anyone else had this problem or have a solution??
More additions:
The reason the htmlLoader class was not compiling was due to the source action script provided being ActionScript 2.0 - the htmlLoader class is a 3.0 library.
However, after more investigation I have found the current structure.
The air app has an html base/root doc. On periodic javascript events - .swf files are downloaded via
videos = new air.Loader();
netStream = new air.URLRequest(path + file);
videos.load(netStream);
So now I have a html container in my air app that creates a new air.Loader which downloads the external .swf file in which I want an onClick event in the action Script of the downloaded .swf file to call a Javascript method of the parent air container. Simple yea?
Or am I making life to hard for myself? Have been looking at the security snadboxes but I don't see how I can get the .swf file to talk nicely with the outer air container. Please help if able.
Thanks
KyleHi Kenneth,
Your explanation makes sense.
I have a big JavaScript file full of special mathematical functions written by a mathematician who only knows how to program in Javascript.
I need to call the Javascript functions from within an ActionScript library, which obviously has no UI, and thus HTML and/or HTMLLoader are not an option.
Any ideas?
TIA,
mlavie -
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.
Maybe you are looking for
-
I have an HD Radeon 6570 video card in this h8-1020 PC. It is only capable of running 3 monitors, I require a 4th. Not for gaming, just for daytrading (running charts). I have tried buying external video cards, however they still limit me to running
-
Import Text File to Oracle Table
Hi Guys, Just needed some advice on how to approach this project. I need to set up an automated schedule to import a text file into an oracle table. There will be a folder set up, where a file is put every day for me. The file will have a name such a
-
Preference panel corruption?
I have a small, annoying problem in my system preferences. I just noticed that the speech panel is corrupted in some way, and I wonder if anyone has any tips on how to either reinstall it or to fix it. I can click on it like normal, and it opens up t
-
Oracle ODBC error when inserting "end" or "begin"
I think I may have found a bug in the Oracle ODBC driver.... I am using version 8.01.73.00 of the Oracle ODBC driver, and my VB application is trying to insert a record into a table using ADO. All works fine, until the user tries to enter the word "e
-
HIS and AD hoc REPORTS in ABAP-HR
hi all, can any body explain abt ad hoc and his reports? what is the use of these reports?