# ExternalInterface help

**URL:** <https://forum.kirupa.com/t/externalinterface-help/287955>\
**Category:** flash\
**Created:** [May 8, 2009, 2:05pm UTC](https://forum.kirupa.com/t/externalinterface-help/287955 "2009-05-08T14:05:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goth\_Santa](https://avatars.discourse-cdn.com/v4/letter/g/46a35a/32.png) [@Goth\_Santa](https://forum.kirupa.com/u/Goth_Santa)\
**Post date:** [May 8, 2009, 2:05pm UTC](https://forum.kirupa.com/t/externalinterface-help/287955/1 "2009-05-08T14:05:45Z")

</div>

I’m trying to have two flash menus talk to one another via ExternalInterface, but for whatever reason the javascript function isn’t being called.

I have two menus, topMenu and tabMenu. The idea is for clicking on one to, among other things, send a message to the other.

First, the JavaScript:

```auto

<script type="text/javascript">

swfobject.registerObject("tab", "9.0.0");
swfobject.registerObject("topMenu", "9.0.0");

window.onload = function () {
  var tabMenu = swfobject.getObjectById("tab");
  var topBit = swfobject.getObjectById("topMenu");  
}

function goBetween (msg) {
  if (msg == "top") { // top is selected
    tabMenu.asCommunicator();
    alert('ok');
  } else if (msg == "side") { // side is selected
    topBit.asCommunicator();
  }
}

</script>

```

Now, the relevant AS in tabMenu:

```auto

import flash.external.ExternalInterface;
ExternalInterface.addCallback("asCommunicator", this, asCommunicator);
function asCommunicator():Void {
    _root.clicked = "other";
    for (i in menuArray) {
        menuArray*.gotoAndStop(1);
    }
}

```

Finally, the code in topBit:

```auto

import flash.external.ExternalInterface;
// on a movieClip:
onClipEvent (load) {
    this.onRelease = function () {
        ExternalInterface.call(goBetween, "top");
    }
}

```

Obviously I haven’t put the code in for two-way communication, but I want to get this working. As of now, clicking the button on topBit does absolutely nothing. No errors from Firebug, and the **alert** doesn’t come up, so goBetween() isn’t being called.

Any ideas?
