Results 1 to 5 of 5
-
February 19th, 2008, 10:47 AM #15Registered User
postsHow to execute code using ExternalInterface on page load?
I have been trying everything I can find to have code start on the window.onload event that uses callbacks exposed via the ExternalInterface. I've had many of the attempts working in IE, but Firefox is causing me grief.
I tried simply calling the code via an "onload=" statement in the body tag for starters, but that didn't work because (I'm assuming) the Flash piece wasn't loaded when onload was called. So I tried putting a line in the Flash that calls a javascript function once it's loaded up. I tried this both by putting the ExternalInterface.call statement in a "this.onLoad=function(){" block as well as just putting the call at the end of the statements on frame 1 of my presentation (with a stop() on the frame) - either way it isn't happening in Firefox.
I also tried using a setInterval in Javascript to test to see if one of the methods exposed via the ExternalInterface is an object (or not undefined). Once again, it's working in IE, but not in Firefox. Here's the code I'm using for that attempt:
==
var intCheckIfLoadedInterval=0;
function checkIfLoaded(){
//alert(thisMovie("Media_Center").setDefaultClip);
if(thisMovie("Media_Center").setDefaultClip!=undef ined){
clearInterval(intCheckIfLoadedInterval);
mediaCenterStartupFunction();
}
}
function initMediaCenter(){
document.getElementById('mediaCenter').style.top=" -700px";
document.getElementById('mediaCenter').style.visib ility="visible";
intCheckIfLoadedInterval=setInterval("checkIfLoade d()",500);
}
window.onload=initMediaCenter();
==
Please let me know if you have any suggestions. The only other thing I can think of at the moment is using the swfObject for writing the flash tags to the page, but I'm already writing them from an external file (and removing the IE "Click to activate this control" issue in the process). All these methods work fine after the initial load (although I also had issues with Firefox when I simply try to call the onload instructions after a setTimeout command as well).
Thanks for your help.
-
April 10th, 2008, 03:27 PM #21Registered User
postsExternalInterface.call() in Firefox
I've been having a similar problem with ExternalInterface.call() in Firefox. It will only work when my flash movie is actually visible on screen.
I was having problems with larger documents when my flash was near the bottom. Basically my users needed to scroll down to the flash object before it would begin receiving calls from ExternalInterface.call().
This recently began happening, so it must have been included in a Firefox update. Don't know if this is related to your script.. Thought I'd suggest it anyway.
-
February 16th, 2012, 11:46 AM #3AndreGD25n/aGuest
postsExternal Interface
So I'm having the same issue. I believe that because the Flash SWF has to expose the function call, that any type of onLoad or even using SWFObject's embedSWF call that allows for a call back function, won't work because the Flash SWF has not yet exposed that call. I'm a JS novice so I'm not sure of the best solution.
-
March 22nd, 2012, 10:55 AM #4Juryskon/aGuest
posts
Unbelievable! Thanks!
I've been solving this for hours! Firefox made me pretty angry. Thank you man, I animated div that displays flash and after adding timer until flash is fully visible it works like a charm.
-
March 22nd, 2012, 11:03 AM #5Juryskon/aGuest
postsHmm
I would try changing the swf. Try to include "ExternalInterface. ..." in base class and make it available from start. In your flash function handle the request - if flash isn't fully loaded response with something to js (like "unprepared") and js can show something for user. Once loaded, calling this callback flash function will response with proper reaction.

Reply With Quote


Bookmarks