Using Flash 8 ExternalInterface for JavaScript Interaction
Jan 30
If you’ve done any Flash/JavaScript interaction then I’m sure you’re well aware of the different approaches you can take. There’s getURL, fscommand, and the JavaScript Integration Kit. While I’ve tried all three my new favorite is Flash 8′s ExternalInterface class. This is by far the cleanest way to do Flash/JavaScript integration.
While this article goes into good detail of how to communicate in both directions, there’s one MAJOR piece missing. I spent a good deal of time trying to debug my code thinking there was something wrong, but it turns out one of my object/embed parameters was incorrect. Be sure to set the allowScriptAccess parameter to “always” because it’s set to “sameDomain” by default. I struggled with this in both Safari and Firefox. After changing this parameter my code ran perfectly.
