Psyked *
it’s easy once you know how.ExternalInterface not working in Firefox?
Posted by James - 20/10/07 at 11:10:39 amHere’s a wierd one. Let’s say you have a flash navigation – one of those old DHTML style drop-down ones, but done in flash and layered over the top of your page content. You can stick the wmode to transparent and have a transparent background for your flash.
That’s dandy – but in most browsers (ie. firefox) you’ll run into problems interacting with the content underneath your flash movie, particulary hyperlinks. Hyperlinks and form fields just become inaccessible. Setting the wmode might make things transparent, but it doesn’t help the ‘click-through’ aspect of transparency. So, what do you do? The solution I’ve been using is a JavaScript function which resizes the flash movie, activated using ExternalInterface.
The problem?
In Internet Explorer, it works fine. JavaScript calls, DOM elements resize. Firefox? No dice.
The solution.
The solution I found has prettymuch baffled me as to why it should work, but it does. Using the fully-qualified class name for ExternalInterface (flash.external.ExternalInterface) solved all of my Firefox woes.
So quite simply – change your ExternalInterface.call(); to flash.external.ExternalInterface.call();




Oh thank you, that was really, really annoying. It appears to be file-specific, I use ExternalInterface all the time, even have an updated ‘traceLog’ class that automatically adds extended info and traces to both regular trace and Firebug’s console.log() in Firefox, and in this ONE file no matter what I did ExternalInterface would not work.
All of my other files worked fine, even ones using the same exact class file (added to my main AS2 classpath). Could be something to do with the fact that this FLA was created on a Mac and published on a PC? Not likely but who knows… that’s the only difference I can think of between all of my working files and this one.
Comment by Tom — 18 January 2008 #
I wouldn’t've thought it could be a Mac / PC issue, both of the files that caused me hassle were created and published on a PC.
We have had separate issue with flash MovieClip loaders failing, apparently due to the hosting server being unix-based. I wonder if that has any effect on ExternalInterface?
Comment by James — 19 January 2008 #
Why the heck does this not work? Would this not be a workaround for the popup blockers.
myClip.addEventListener(MouseEvent.CLICK, myButtonFunctionWOW);
function myButtonFunctionWOW(event: MouseEvent) {
flash.external.ExternalInterface.call(“http://www.site.com/index.html”,”_blank”,’height=600, width=200′);
}
Comment by Green — 15 October 2008 #
Green – the ExternalInterface has to call an existing function in the page – I see what you’re trying to do, but you’re doing it wrong!
The 1st variable of the call has to be the function name, and the next are the variables, I think. So what you’re trying to do is call a function named ‘http://www.site..’ which doesn’t exist. You need to call a function that creates a new javascript window, and pass the url and target as variables to that.
Have a look at this page.
Comment by James — 16 October 2008 #
Wow.. you just saved me a heap of trouble.. thanks!.. Does beg the question of WHY.. but then actionscript 2.0 always was quirky.. Will be glad when all my work gets onto 3.0
thanks again
Comment by Robert — 2 February 2009 #
Thanks.
This works perfectly!
Comment by Ed — 9 February 2009 #
I just want to confirm that this solution works. This is great, I always wondered why External Interface failed in AS2.
Coincidentally you do not need to implement this for it to form from AS3, thanks Adobe.
-aubz
Comment by Aubrey — 13 March 2009 #
thanks man, it works
Comment by Viktor — 19 March 2009 #
Doesn’t work for me unfortunately… Doing flash.external.ExternalInterface.call(“alert”, “WTF?”) still does nothing.
Comment by Dave — 23 May 2009 #
@Dave – have you tried creating your own javascript function in the HTML page? I’m not sure if you could call ‘native’ javascript methods via ExternalInterface – but maybe you could make your own wrapper function in javascript that would do the same thing.
This link might help.
Comment by James — 25 May 2009 #
It’s able to call native functions. you may even call console.log if you have firebug enabled
Comment by aw — 22 June 2009 #
Just tried the FF fix and I still am getting no dice with FF 3.5.
Have you tried this is the latest FireFox 3.5?
Comment by Nathan — 1 July 2009 #
After also having these problems with FF 3.5 i found out what was wrong in my case.
When i inspected the DOM i saw that in FF using the (Adobe preffered) way of getting a pointer to the Flashfile, document[flashid] returns a NodeList when using the Prototype framework.
This nodeList contains 2 nodes, the embed and the object tags with the id=FlashId and name=FlashName.
I worked arround this “problem” by checking if the value that’s returned by document[FlashId] has a length attribute and when it does, take the 2nd element of that array to work with.
This seems to work in the most popular browsers.
Tested it in IE, FF, Chrome, Safari (PC version) and Opera
Hope this helps anyone with the same problem.
Greetz Superficial
Comment by Superficial — 4 September 2009 #
Hello could you Superficial could you expand on your solution for the lest technically minded?
thanks
Jon
Comment by Jon — 7 September 2009 #
@Superficial
You mean on the lines of this?
http://corona.pastebin.com/m29c2a5e5
Comment by Corona — 15 September 2009 #
srry wrong link
EDIT:
http://corona.pastebin.com/d4d25a0d1
Comment by Corona — 15 September 2009 #
I was having problems with ExternalInterface and Firefox and Chrome and discovered that the Adobe Script was not writing the Flash tag quickly enough, so when the browser tried to find the addCallback() function it was not there at the time.
Simply putting my Javascript function that calls the Flash created addCallback() in a window.setTimeout() calling solves the problem. Delays less than 200 ms still make the problem to occur.
I didn’t have to use the solution of trying to find if the “length” attribute exists in the document[FlashId] object. Just calling “FlashEmbed = document[FlashId]” worked just fine.
Comment by Robson Waterkemper — 8 December 2009 #
Thanks for the tip, Robson – hopefully will prove useful to someone!
Comment by James — 8 December 2009 #
I cant thank you enough. I spend hours trying to figure what the fuck is wrong. And using the fully qqualified names solves it.
I still wonder why this solves the problem.
Comment by Suraj Chandran — 1 April 2010 #
No man this did NOT work.
Thank you though for trying, I wish it were this simple.
Comment by sean — 30 April 2010 #
i will subscribe to ur rss feed!
Comment by Randy Lindemann — 28 August 2010 #