# External Interface problem

**URL:** <https://forum.kirupa.com/t/external-interface-problem/267006>\
**Category:** flash\
**Created:** [July 27, 2008, 9:18am UTC](https://forum.kirupa.com/t/external-interface-problem/267006 "2008-07-27T09:18:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xenophobia](https://avatars.discourse-cdn.com/v4/letter/x/eb9ed0/32.png) [@xenophobia](https://forum.kirupa.com/u/xenophobia)\
**Post date:** [July 27, 2008, 9:18am UTC](https://forum.kirupa.com/t/external-interface-problem/267006/1 "2008-07-27T09:18:03Z")

</div>

In flash I had this code:

```auto

import flash.external.ExternalInterface;

function abc(){
    txtNotice.text = "abc";
}

ExternalInterface.addCallback("abc",null,abc);

```

In javascript:

```auto

var x = document.getElementById('myFlashID');
x.abc();

```

Assume that in the flash movie, I had a dynamic textbox which will display the text “abc”;

So I want to call the flash’ function from javascript using the ExternalInterface.

The problem is, once I load the flash, and call up the function in JS, I get abc is not a function.

Meaning function not defined.

But the strange things is, when I do this in javascript:

```auto

var x = document.getElementById('myFlashID');
alert(x);
x.abc();

```

The abc displayed!!! The alert make the script work. What is the problem! I tried out my whole  
day for it. I can’t figure out what could happened.

In flash object, i had put the value “allowScriptAccess” to “always”. When I alert ‘x’, it return  
the HTML object element. Meaning should not be a problem. Is only that I can’t call the function  
without alert(x);

I aslo noticed, even if I alert(‘something else’), the flash also ABLE to display the text ‘abc’  
in the dynamic box.

Help me out! Thanks in advanced!!!
