# DOMEx class

**URL:** <https://forum.kirupa.com/t/domex-class/302576>\
**Category:** open source\
**Created:** [January 3, 2010, 10:46pm UTC](https://forum.kirupa.com/t/domex-class/302576 "2010-01-03T22:46:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_tadster](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@a\_tadster](https://forum.kirupa.com/u/a_tadster)\
**Post date:** [January 3, 2010, 10:46pm UTC](https://forum.kirupa.com/t/domex-class/302576/1 "2010-01-03T22:46:04Z")

</div>

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:

```auto

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:

```auto

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:

[http://www.actiontad.com/DOMEx/](http://www.actiontad.com/DOMEx/)
