Skip to main content
October 12, 2010
Question

Close window on Movie swf end

  • October 12, 2010
  • 1 reply
  • 1780 views

Hi I have searched everywhere for an answer and can only find outdated results for flash 8.

I have an animation that opens in a html page in a new browser window. Once the animation ends I would like to have the window close automatically.

Please can someone give me the script to do this. I am a newbie to flash but thought this would be simple. ??

This topic has been closed for replies.

1 reply

October 12, 2010

AS3 side:

ExternalInterface.call('closeWindow');

HTML side:


<script type="text/javascript">
function closeWindow()
{
window.close();
}
</script>

October 12, 2010

I have put the html part in my head tags and the AS3 (??) in my flash movie on the last frame but am still getting nothing.

On my hard drive it comes up with a security alert and on the server nothing happens.

Anything else you can add will be appreciated. i have a job needs finishing today and I'm getting well frustrated.

October 12, 2010

can you put a link to your online html ?

There should be no problems with IE.

For FF : For security reasons, your script cannot close a window/tab that it did not open.

Try for FF:

   <script type="text/javascript">
function closeWindow()
{
//window.close();
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");   
window.open('','_parent','');  
window.close();
}
</script>