Flash movies (.swf files) can talk with Javascript code embedded in the same HTML page. There are two ways to do this:
- The preferred way is to use the ExternalInterface class to call Javascript functions from ActionScript, and to bind ActionScript functions to the Flash movie's DOM element so they can be called from Javascript.
- The deprecated way is to use the global
fscommand
Show archive.org snapshot
function to call a Javascript function with a fixed name from Javascript. In return Javascript can sort of communicate with ActionScript by calling
SetVariable(name, value)
on the Flash movie's DOM element. This is super-legacy, but still encountered in the field.
Note that communication between a Flash movie and a piece of Javascript code is blocked unless they both live on the same domain. You can lift this restriction by adding a allowscriptaccess="always"
attribute to the Flash movie's <embed>
tag, and a <option name="allowScriptAccess" value="true" />
child tag to the Flash movie's <object>
tag (which we keep around for Internet Explorer).
The attached link has more information.
Posted by Henning Koch to makandra dev (2011-03-02 16:08)