Flash ExternalInterface - Debug checklist

Flash' ExternalInterface api allows you to communicate between Javascript and Actionscript. A very useful tool, and we've used it quite a few times. Often times it just doesn't work though, and it can be difficult to get to the root of the issue. This is a list of things you should be looking out for if ExternalInterface does not work for you:

Give your <object> tag an id

In order to call your flash application, your tag needs to have an id attribute. Make sure this attribute is unique.</p>

The id cannot collide with items in the document object

Internet Explorer will add any element with an id to the document object. So if you were to, say, give your object the name 'window', 'getElementById' or anything to that respect EI will not work.

The object cannot be embedded in a <form> tag

EI will not work in IE if the object sits in a

-tag. For some reasons IE will treat any element within a form slightly different.</p>

Don't use 'play' or 'stop' for method names

Another IE issue. play and stop are somehow reserved for IE. This only applies to actionscript functions you're calling from javascript.

Check your domain names

If your swf is loaded from a different domain as your html document, you need to make sure you add this domain through flash.system.Security.allowDomain. In our case it was fine to just add `Security.allowDomain('*')`.

If all else fails, know how to debug.

Much like with XMLHTTPRequest, errors will not show up in Firebug by default, but you can trace everything if you check everything in the Console-tab-submenu. This will also allow you to see some of the automatically generated javascript Flash produces.

Most of the above issues are in IE, but thankfully Microsoft's script debugger will actually catch these (rather cryptic) errors, which might help you find your problem.

We've run into every single one of these issues, if you have any others like this, please comment :). I figured it would be helpful to have one single source of documentation.

Web mentions


  • stefan


    Just ran into one:
    Make sure the DOM is ready when calling the Flash Functions
  • Jennie


    Very smart idea to have one single source of documentation and looks like you have it well covered!
  • butterbrot


    I also notice having trouble with the external interface when the flash is inside a div which is currently hidden using css position (top/left -9999)

    but it worked when the flash is visible by 1px
  • bob


    The ExternalInterface functions exported to JavaScript, don't work if you are debugging remote.