ExternalInterface Problems in ActionScript 2

Where I work we use a lot of Javascript because the guys doing it are quite gifted and also because I am the only member of the flash department (well designers do flash, but when it gets complicated I handle it), so it is often the case where Flash has to call a Javascript function. With all of my readings I had come to the conclusion that ExternalInterface.call was the best way to access Javascript functions. I guess I was wrong…

Well first of all ExternalInterface works very badly with Opera (at least the ActionScript 2 version, haven’t tested the ActionScript 3 version). Searching a bit I found people saying the it worked sometimes, it worked when it wasn’t inside a mouse related event, etc. Well this isn’t very reliable.

Also I ran in some trouble where when the Javascript was called in the html it worked fine in all browsers, when I used ExternalInterface it worked fine in Internet Explorer, didn’t do a thing in Opera and just crashed Firefox. Well that’s nice cross-browser behavior…

To solve my problem, I just had to do it the good old way; getURL(“javascript:myFunction()”). For the same Javascript function (the one that crashed FireFox), it worked in all browser. I hope this all works better in AS3.

, ,

  1. #1 by cisnky - March 17th, 2008 at 04:49

    Sorry to hear that you had problems with External Interface. I can’t comment on Opera because it wasn’t in our spec for the prototype we built, but I had really good results with Firefox. Sending a JS Array into Flash via JavaScript and Flash dealing with the Array was a blessing. Our application had 30+ calls being made to Flash via JavaScript in any session and it functioned without crashing.

  2. #2 by John Conor - December 2nd, 2008 at 08:15


    I am facing the problem with ExternalInterface when I call a method which returns any value from javascript to Flash. It always return null value in IE.

    is this getURL method works with the methods which returns values ???

  3. #3 by zedia.net - December 2nd, 2008 at 15:48

    I’m afraid you can’t use getURL to call javascript function that return something. I think you should look into this method : ExternalInterface.addCallBack(), so that the Javascript sends you back data but I never used it.

(will not be published)
Subscribe to comments feed
  1. No trackbacks yet.

Parse error: syntax error, unexpected ';' in /homepages/25/d169645162/htdocs/wp-content/themes/fusion/footer.php on line 13