[osflash] Ramouz: Exit button to close window

Corey Bissaillon corey at uptimemusic.com
Wed Dec 27 12:21:21 EST 2006


Ramouz,

For your exit button in Flash 8,  you can use the ExternalInterface  
class:

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/ 
html/wwhelp.htm?context=LiveDocs_Parts&file=00002200.html

So your exit button code might look like:

on(release){
    jsClose();
}


And on frame 1 of your Actions layer,  import the class and define  
the function:

import flash.external.ExternalInterface;

function jsClose(){
	ExternalInterface.call("closeWindow");
}


Then, between the head tags of the page which loads your SWF,  add  
the javascript function "closeWindow()" such that it will close the  
window:

<SCRIPT LANGUAGE="JavaScript">
<!--

function closeWindow() {
   window.close();
}

// -->
</SCRIPT>



Hope that helps!


- Corey Bissaillon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20061227/cdd88474/attachment.htm


More information about the osflash mailing list