I have a Flash movie which has a number of actionscript 2 functions which are exposed to Javascript via ExternalInterface. Normally this movie works fine and Javascript can communicate with it. But sometimes, intermittently and without explanation, the flash object in Javascript will not have the ExternalInterface functions. This happens when I have this single flash file installed on the page more than once, and it often happens that one or two instances of the flash will have the functions, and one or two will not. Same exact flash source, embedded onto the page 3 or 4 times. Very odd. Any ideas as to what might be wrong or even where I should start looking? I am at a loss.
+2
A:
Maybe you problem is that the Flash app is not ready when you make the call.
Whenever I had to do communication JS > Flash I always let Flash "do the talking". Basically, enable a JS function that the Flash movie calls when it's ready and fully loaded. Then and only then allow the JS side to make calls to Flash.
HTH!
Juan
Zárate
2009-04-29 07:01:55
@Juan, That's a very good point, let me go back and investigate: I already have Flash set up to tell Javascript when it is 100% loaded, after which Javascript can begin communicating with it. Let me see if that signal is indeed being sent.
Josh
2009-04-29 11:17:47
@Juan, you may have found the answer. My Javascript function called when the flash is ready doesn't seem to be getting called! I'll confirm this and if so, mark your answer as correct.
Josh
2009-04-29 14:25:39
@Juan: Actually I just realized I was wrong -- the JS function called when the flash is ready *is* called -- but *twice* for each instance of the flash! So something is clearly wrong here and you have pointed me in the right direction. Thanks!
Josh
2009-04-29 14:31:48
I don't know what I was doing wrong but it was a Javascript issue, not Flash. Reverting back to an earlier version of the js code fixed the problem.
Josh
2009-05-09 12:42:46