The DOMEx class can be used to simplify communication between JavaScript and a SWF.
With it you do not have to script for the swf to call callbacks.
And you can also set things up so you can call any public function in your swf from one JavaScript command.
Basic use:
[AS]
public function myActionScriptFunction(… args):*
{
//things to do in the swf
}
DOMEx.addCall(“nameForTheCallBack”, myActionScriptFunction);
DOMEx.makeMasterTalk(“nameYouWant”, “nameForTheCallback”, DOMEx.idGet());
[/AS]
Then in the wrapper you can simply call:
nameYouWant(... args);
to call myActionScriptFunction,
and no setup or scripting for the swf in the wrapper is required.
Simple setup to be able to call any public function in the swf:
[AS]
DOMEx.addCall(“nameForTheCallBack”, new DOMEx(this).invokeViaJavaScript);
DOMEx.makeMasterTalk(“nameYouWant”, “nameForTheCallback”, DOMEx.idGet());
[/AS]
Then in the wrapper you can do:
nameYouWant("publicActionScriptFunctionName", ... args for the AS function);
to call any public function in the swf.
It also has some other usefull functions to do other things on the DOM
without needing to set up anything in the wrapper.
The only thing needed is that your swf object must have an id.
It is basically the same as the ExternalInterface class with added functionailty.
here is a link to full documentation and the source: