ExternalInterface Issues
JS Code:
function iclicked() {
var myFlashMovie = document.getElementById("flashID");
myFlashMovie.javaFn();
AS3 Code:
ExternalInterface.addCallback("javaFn", flashFn);
function flashFn() {
// Do this
The problem is that with this code, I receive an error that says javaFn is not a function.
I was researching and I read that the problem may be that there may not have been enough time for it to completely load but I doubt that is the problem.
I am willing to try this solution but how would I go about not going any farther, until five seconds have passed by?
Are there any solutions out there?
I changed the JS to:
function iclicked() {
var myFlashMovie = window.document.flashID;
myFlashMovie.javaFn();
I am still getting the same error.
I can't even do, "myFlashMovie.play()".
Similar Messages
-
Hi to all!
I'm working on an as2 fla and I have to play a movie clip when a user click on a html link placed in the html outside the swf.
I did some trial and googled around but no way to get this to work. So i've tried to set up a simpler file to test the ExternalInterface.
The thing i'm trying to do is this (see also the attached files):
In flash, i placed on the stage a txt box on the first frame.
Always on the first frame i coded this:
flash.external.ExternalInterface.addCallback("funzia",ciccio)
function ciccio(){
txtProva.text='ciao'
In the html, accordin to the suggestion of Adobe i coded in js this:
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
function apriDati() {
getFlashMovie("prova").funzia();
When I try to invoke apriDati() with Firebug it fails with the following error:
TypeError: getFlashMovie("prova").funzia is not a function source=with(_FirebugCommandLine){apriDati()\n};
It seems it doesn't recognize the object
If i Trace onlye the getFlashMovie("prova") i receive this output:
[object, embed]
and if i try getFlashMovie("prova")[0]
<object width="550" height="400" align="middle" name="prova" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
and if i try getFlashMovie("prova")[0].funzia it fails with the same error listed above.
Any Ideas?
Thanks in advance.
Best regards and good weekend!!!!Hi kglad!
Thanks for your reply. I've tried to set the additional parameter you suggested, but it still doesn't work.
It's a very weird behaviour.
I also tried to get referenced to the flash movie with:
var flash=document.getElementById("FlashID")
instead of using the method suggested by Adobe
When I log the "flash" var in firebug, it returns:
<object id="FlashID" width="550" height="400" title="externalfile" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" style="visibility: visible;">
but when I try to perform:
flash.callMe()
it complains with:
"TypeError"
flash.callMe is not a function
What do you think?
This is only a flash issue, or there could be something also in the javascript side?
Thanks in advance!
Have a nice day!
Best Regards!
Luca -
NPAPI ExternalInterface "issues"
So I'm writing an app which hosts the flash plugin using
NPAPI. Now, I've not got a javascript engine so I need to use
NPN_Invoke and its kins.
Unfortunately when I call out to from flash to the host e.g.
ExternalInterface.call( 'testfunc', 'arg1', 56, { 'some':
66, 'inter':'est' } );
I DON'T get NPN_Invoke called, instead it calls NPN_Evaluate
wrapping the call I'm trying to make in another javascript function
(__flash__toXML) which converts the return return value to XML,
which is frustrating as I don't have a javascript engine.
Now I've noticed that by changing the user agent I return,
flash changes how it queries values e.g. sometimes it invokes
top.location, sometimes it evaluates a javascript function (using
NPN_Evaluate) to retrieve it.
What I want to know is "Can I make Flash call Invoke rather
than Evaluate", Its soooo frustrating as I don't want or need a
javascript engine and there's no reason it shouldn't be able to.
I've found I can avoid the need to handle NPN_Evaluate when calling
into flash by invoking "CallFunction" and serializing the
parameters into xml, so I'll be amazed if I can't get calling out
to work without NPN_Evaluate.
Please help
Richbump!
Anyone? is there anyway to get flash to call invoke instead
of evaluate with a javascript string?
Help!
Rich -
ExternalInterface issue in as3
Iam calling some JavaScript function with ExternalInterface in as3. That java script function set flashObj.SetVariable("userName", userName) .Icant get userName value but it is working in as2
show your ei related code and your called javascript function.
-
Flash 10 ExternalInterface and AJAX issues in IE
Our site has been working fine for a year with Flash Player
9.
After we install Flash Player 10 the Flash to JS interface
(ExternalInterface) appears NOT to work after new page content is
loaded via an AJAX call.
Example:
1. Load site with Flash content - all is good and
ExternalInterface works fine
2. Click to load new content area containing Flash via AJAX
call - page content loads ok
3. The SWF's in the loaded content cannot use
ExternalInterface. Even ExternalInterface.addCallback() call fails
Only thing that changed appears to be the Flash version 10.
We have founf one vista machine with Flash 10 that does work.
All XP and other Vista machines fail. Firefox works just fine with
Flash 9 and 10!I'm having the same exact problem. I've uninstalled,
reinstalled, the works. Flash works great in my alternate browser,
Opera, but not with IE. -
ExternalInterface to Javascript/Html Issue
AdobeTV showed a way to allow Flash to "talk" to an HTML page via javascript using the ExternalInterface method. There seems to be a catch. You need to use the ID of the swf in the parameters to have it all fit together and you can only put the ID="swf" into the IE section of the Dreamweaver generated javascript or into the non-IE section. Putting it in both didn't work and the author mentioned only putting in one of them specifically.
Is there a way to do this that would work in both sets of generated Javascript?use:
import ....ExternalInterface;
ExternalInterface.call("yourJSfunction",<parameters>); -
Hi all,
In Flex Builder3.0, am loading an External AS3.0 complied
SWF( AVM2-AS3 swf) , which in turn loads an AVM1-AS2.0 complied
SWF, This AVM1 movie has some External Interface call which calls
some JavaScript function, which works Perfectly when I compile it
in the Flex Builder in play mode, but when I try to do it in the
debug mode External calls were not happening, I have a big problem
in my App, since I need to see stuff in the
console.....Interestingly my FireFox =V-2.0.0.16 Works nice in
debug mode but not IE7 and FireFox 3
Please let me know
Regards,
Amuthan MeganathanChange the value of "allowScriptAccess" param to "always" from "sameDomain" in the generated HTML, if you are testing your html from the local file system. If you host it on a webserver, this would not be required.
Take a look @ http://helpx.adobe.com/flash-player/kb/changes-allowscriptaccess-default-flash-player.html #main_DIAGNOSIS for more details.
-Dharmendra. -
Hi Gurus,
In dashboard while selecting prompt getting 'Unable to get value of the property 'viewstate':object is null or undefined error.i am using IE 9 browser.
could you please let me know how to resolve this issue ? Thanks in advance.See http://msdn.microsoft.com/en-us/library/gg622942%28v=VS.85%29.aspx
Basically, IE9 breaks flash ExternalInterface calls if your flash component is embedded with an object tag with an embed tag fallback, and the object id and embed name is the same.
The easiest workaround is to tell ie9 to render your page in IE8 Standards mode. To do this, insert this in the element:
<!-- Enable IE8 Standards mode --> <meta http-equiv="X-UA-Compatible" content="IE=8" >
Otherwise, you might just want to use the object tag only or embed tag only. -
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 !! -
SecurityDomain and Caching Issues
I am running into some caching issues when setting the securityDomain of an imported SWF to match the calling SWF file and I was curious if anyone had any ideas on how to get around this issue.
Here is the scenario:
A.swf is launched on Domain A, it sends a Loader request for B.swf on Domain B.
B.swf will be updated frequently so caching is disabled, A.swf however can be cached.
B.swf has some ExternalInterface.calls so it requires being in the same securityDomain as A.swf otherwise it will receive a Security Error #2006.
The code I am using for this is fairly straightforward:
ActionScript Code:
var request:URLRequest = new URLRequest("http://domainB/B.swf");
var loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
loader.load(request, context);
I believe B.swf is inheriting the caching setting of A.swf because it is residing in the same securityDomain. If I make a small update to B.swf and refresh A.swf in a browser it will not load the B.swf updates until I clear cache.
If I get rid of the securityDomain context on the load it will always update B.swf with the most current version, but I run into security issues with ExternalInterface.
ActionScript Code:
var request:URLRequest = new URLRequest("http://domainB/B.swf");
var loader:Loader = new Loader();
loader.load(request);
I have tried appending random strings to the end of the URLRequest while using the securityDomain context but it will always used a cached version of B.swf. I have also tried loading B.swf into a ByteArray then using loadBytes on a Loader but that didn't work either.
Any ideas are appreciated!Hello,
#1
are you using explicit call to flush method immediately afer you're writing data to reference to SharedObject?
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject. html#flush()
If not you could have different data read by different browsers sessions run at the same time (e.g. IE/FireFox both hosting your test Flash movies) - as data are flushed only when given Flash runtime session is to be terminated (e.g. movie is to be unloaded) and in other cases as outlined in documentation.
#2
the SharedObject is reference to binary file stored on local machine by Flash runtime (Air runtime too). It has nothing similar to web-fetched content to be cached:
http://en.wikipedia.org/wiki/Local_Shared_Object
regards,
Peter -
Strange IE ExternalInterface Bug: "Object does not support this property or method"
We have an application on a relatively slow server (I mention
the speed because it may be relevant).
The app is flash 8 and uses ExternalInterface to call a
javascript function in its parent page. It also used the
ExternalInterface to receive a call from another function. These
calls happens separately (the outbound one calls up a list view of
items, clicking on an item calls up the details in the flash
movie). In between the calls, the flash movie is hidden by moving
it off screen using absolute positioning.
On my local development box (Windows XPSP2) this works fine
in both directions.
On our production server (LAMP) this works fine in both
directions in Firefox 1.5 and 2.0
BUT while the outbound call from Flash to the page works fine
in Internet Explorer 6 or 7, the call back from the page to the
flash movie fails with the error messgage "Object does not support
this method or property"
We've tried not hiding the flash so it is always present on
the page and still the browser > flash communication breaks in
ie.
We've tried using both the Adobe active content script and
swfobject to embed the flash in the page with no difference in the
resultset. In truth we've given up and gone to a two-page solution,
reloading the flash from the start each time but I wondered if
anyone had encountered a similar issue? Can't see why it would work
perfectly in FF but not in IE.Not sure if this is your problem, but you do reference the
Flash object
differently, depending on the browser. In a video player we
made, that uses
JS to communicate back to Flash, I use a function like this
to modify the
variable depending on the browser:
function changeVideo(xname){
//ff
if(window.vplayer){
window.document["vplayer"].SetVariable("theXML", xname);
window.document["vplayer"].GotoFrame(2);
window.document["vplayer"].Play();
//ie
if(document.vplayer){
document.vplayer.SetVariable("theXML", xname);
document.vplayer.GotoFrame(2);
document.vplayer.Play();
The Flash is in a <div> named 'vplayer'
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Flash Player Video Performance issue in IE 9.0.124
So everything was going fine until we got all users to update
their player to the new 9.0.124 version. We host HD videos on our
site and people love the quality we provide. Well at least until
now. Videos started to stutter while download is still in progress.
That is once the video is completely downloaded the stuttering
stops. This is seen only is IE (on Windows). On FireFox and Safari
(on Windows) this issue is not seen at all.
Now we have a ExternalInterface call back in the download
progress event that calls into a javascript method on the page.
This javascript method simply displays the information it gets as a
parameter. No complicated or tim consuming work is being done here.
After doing some tests we find that if we remark out the call
to ExternalInterface.addCallback the stuttering stops happening. So
it looks to me like something has changed (in this new version) in
the way the ExternalInterface stuff works, to the extent that it
hampers video playback.Bentley,
Don't mean to shoot the messenger...so please take this in
good faith.
I'd gladly log a bug if anything was ever done about it. I've
been logging bugs with Adobe on Flash player and Flex for two years
but these bugs are still outstanding and deferred to the next
release :). Releases come and go but the issues are outstanding.
These issues are show stoppers for a lot of people.
I see no point in me taking the extra effort if nothing is
going to be done about it. Other software companies I work with
respond immediately.
Others, won't see the issue unless they're doing what we are
:). Things were working fine until we upgraded to the new player.
To me that's an issue that needs to be addressed no?
I'd gladly provide you with two links, one that shows this
issue and one that does not if it helps verify the problem. -
ExternalInterface is not working?
Hi all,
I have an issue with ExternalInterface.call, it's working fine in IE but not in Chrome I don't know why? is there any solution? please let me know. Bellow you can find the code. Thanks in advance.
AS Code:
import flash.external.ExternalInterface;
var req:String
var msg:String
site_btn.addEventListener(MouseEvent.CLICK, gotowebsite)
function gotowebsite(event){
req = "http://www.google.com/"
if( ExternalInterface.available ) {
Security.allowDomain(req);
ExternalInterface.call( "downloadFileFromAS", req );
msg="good"
}else{
msg="error in ExternalInterface"
msg_txt.text=req
JS Code:
<script type="text/javascript">
function downloadFileFromAS(_fileURL ) {
window.open(_fileURL,"_blank");
</script>
Thanks and Regards
Santhosh Kumar MChange the value of "allowScriptAccess" param to "always" from "sameDomain" in the generated HTML, if you are testing your html from the local file system. If you host it on a webserver, this would not be required.
Take a look @ http://helpx.adobe.com/flash-player/kb/changes-allowscriptaccess-default-flash-player.html #main_DIAGNOSIS for more details.
-Dharmendra. -
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.available returns true in standalone
Incredibly frustrating - no matter what I try, in standalone test environment it always returns true - it should return false - any thoughts on this anyone.
Its just ridiculous that Bugs like this occur.......
Cheers,To add to this - I also have incubator "Molehill" build.
I can simply create a new document - place the following on the root timeline
trace(ExternalInterface.available);
and it will return true.
Anyone help with this ? Adobe needs to be aware of this as it may be an incubator issue, and therefore serious.
Maybe you are looking for
-
Xpath in the collect message of BPM
Hi, I created a BPM collect message. My source message has a field which is in the format of XXXX-NN such that XXXX can be any 4 letters and NN is a number 01 - 99. In the loop of the BPM, I made use of an Xpath command in the condition editor for th
-
Hi, yesterday i turned off my M100 by holding the power switch while it starts. Since the the power LED blinks orange when I turn it on and nothing else happens. I read that this means, that the BIOS is damaged. Is there a way to fix that or is this
-
How do I get rid of ITunes 10 upgrade screen so I can use ITunes Store?
How do I get rid of ITunes 10 ad, so I can use the iTunes store. I can't download 10 on this computer and have purchased from iTunes store in past. Not anymore, any search doesn't work, screen keeps coming back to Upgrade ad.
-
Sync with iCloud while charging crashes WiFi
When i try to sync to iCloud while charging my iPhone 5 my WiFi goes down, not the phone but the router. After restarting the router it works again. Syncing manually while running phone on battery and wifi everyting works fine. Anyone else got this p
-
How to declare class for library like function
Hey guys I want to declare class Math and define method subtrction so that i can use it in other class like package p1 public class Math Math( ){} int Subtration ( int a, int b) return (a-b) package p2 import p1.*; Public Class Test Test() int somenu