Apr 24, 2008

Calling Action Script from the DOM

There is plenty of literature already on how to call Action Script functions from the browser's DOM. The concept is simple:
  1. Write the Action Script function

  2. Use ExternalInterface.addCallback to register the function for scripting

  3. Get a handle on the Flash player

  4. Call the function

However, this is not the case when using IE. Because of a timing issue, the Action Script function is not being registered within IE; therefore producing a Javascript error. The workaround for this issue is to manually register the ActionScript function by calling __flash__addCallback(<Flash object>, <name of Action Script function>).

No comments: