Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : Closing a browser window using actionscript


pktrautman
3/10/2004 9:36:37 PM
I would like to close the browser window that my SWF file resides in by placing
actionscript on a button to close the window. Can this be done without opening
the window first? And is there important code to place in the HTML file that
the SWF file resides in?

I have tried placing "javascript:closeWindow('myNewWindow') with the
"on release" code on my button in Flash and also have placed the following
code in my HTML page and haven't had any luck with it working.

<SCRIPT LANGUAGE ="Javascript">
function closeWindow(windowName)
{
newWindow.close(windowName);
}
</SCRIPT>

---PT
zakopilias
3/19/2004 6:07:52 PM
[h]on (release) {
getURL(" javascript: window.close();");
}[/h]

The above code closes the html that hosts the SWF that containes the button.
One drawback , though : It gives a message first :
"This window is trying to close itself. Do you want to close the window ? Y/N
?"
Yes will close it down.
( I sure hope there`s a way to close it without the message but i`m not aware
of it)
Good luck

AddThis Social Bookmark Button