# ExternalInterface.call not closing window

**URL:** <https://forum.kirupa.com/t/externalinterface-call-not-closing-window/324800>\
**Category:** flash\
**Created:** [September 9, 2011, 12:17pm UTC](https://forum.kirupa.com/t/externalinterface-call-not-closing-window/324800 "2011-09-09T12:17:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewlong](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@andrewlong](https://forum.kirupa.com/u/andrewlong)\
**Post date:** [September 9, 2011, 12:17pm UTC](https://forum.kirupa.com/t/externalinterface-call-not-closing-window/324800/1 "2011-09-09T12:17:56Z")

</div>

I need to have button that closes the window. The window is a .php page, but it has the following javascript function:

```auto
function closeWindow(){    
self.close();
}

```

The AS I have is:

```auto
ExternalInterface.call("closeWindow");

```

When clicked the window does not close.

The odd thing I have another button that scrolls to the top of the page using the following code:

```auto
//JS
function scrollTop(){
    window.scroll(0,0);
}
//AS
ExternalInterface.call("scrollTop");

```

This works fine.

Is there something about closing a window that does not work in AS? Or maybe is there a problem because it is a PHP file? Thanks in advance for your help.
