The javascript:window.close() technique only works in some browsers. The example is only meant to show using keyboard events, and not provide a foolproof way to close all browsers.
I'll make a note of that in the example. Matthew J. Horn Flex docs -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of bhaq1972 Sent: Wednesday, April 12, 2006 7:47 AM To: [email protected] Subject: [flexcoders] Flex2B2 - Handling keyboard events The following example from the help doesn't work. how do i make it work? thanks <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="initApp()"> <mx:Script><![CDATA[ private function initApp():void { application.addEventListener (KeyboardEvent.KEY_UP,keyHandler); } //This function quits the application if the user presses CTRL+Q. private function keyHandler(event:KeyboardEvent):void { var bControlPressed:Boolean = event.shiftKey; if (bControlPressed) { var curKeyCode:int = event.keyCode; if (curKeyCode == 81) { // 81 is the keycode value for the Q key // Quit the application by closing the browser using JavaScript. var url:URLRequest = new URLRequest("javascript:window.close()"); navigateToURL(url,"_self"); } } } ]]></mx:Script> </mx:Application> (btw one typo in the example...needed to remove the 'public' from the local variable) -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

