Title: Re: [flexcoders] Re: Closing via Menu VS via Shortcut Key

Most browser do allow this but some will prompt with a warning message stating that a script is trying to close the current window.

You can supress the warning programmatically for IE but I don't have the script at hand at this moment.

Should you need it just post to the list and I'll submit it tomorrow.

Regards
RR
--
mobile: +49-(0)170-914-5495
email:   [EMAIL PROTECTED]




-----Original Message-----
From: flexcoders@yahoogroups.com <flexcoders@yahoogroups.com>
To: flexcoders@yahoogroups.com <flexcoders@yahoogroups.com>
Sent: Mon Dec 05 21:14:27 2005
Subject: Re: [flexcoders] Re: Closing via Menu VS via Shortcut Key

That _javascript_ would not work. You cannot close the main window even in normal HTML as far as I know.
Try doing a trace ... I am sure the function is being called, but it will not work. The browsers by default will not allow you to do this.
This is a security feature AFAIK.

Try:

<html>
<body>
<a href="" <_javascript_:self.close();> >Close this window</a>
</body>
</html>

Sree

fowleryj wrote:

        I've also noticed that replacing the "getURL" line with a function
        call results in the function not being called:
       
        Instead of
        >         if(currentKeyPressed == 99 && lastKeyPressedControl) {
        >             mx.controls.Alert.show('CTRL + c');
        >             getURL("_javascript_:self.close();" <_javascript_:self.close();> );
        >         }
       
        I now have
        >         if(currentKeyPressed == 99 && lastKeyPressedControl) {
        >             mx.controls.Alert.show('CTRL + c');
        >             closeWin();
        >         }
       
        And closeWin() looks like this:
        public function closeWin() {
              mx.controls.Alert.show("closeWin");
              getURL("_javascript_:self.close();" <_javascript_:self.close();> );
        }
       
        The "closeWin" popup is never fired. Any ideas? Is anyone else
        successfully closing a window via a shortcut key combination?
       
        --- In flexcoders@yahoogroups.com, "fowleryj" <[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]>  wrote:
        >
        > Hello all,
        >
        > I'm able to close a popup window in my application via the
        menuChangeHandler, like so:
        >
        > private function menuChangeHandler(event) {
        >     if(event.menuItem.attributes.data == "Close") {
        >         getURL("_javascript_:self.close();" <_javascript_:self.close();> );
        >     }
        > }
        >
        > However, when I try to close the window via a shortcut key, I get
        the message box I'm invoking, but the window itself doesn't close
        (note that even before I put the message box code in, the window
        didn't close, so that's not preventing the window from closing):
        >
        > var lastKeyPressedControl:Boolean = false;
        > var currentKeyPressed;
        > public function initKeyListener() {
        >     var keyListener = new Object();
        >     keyListener. {
        >         currentKeyPressed = Key.getAscii();
        >         if(currentKeyPressed == 99 && lastKeyPressedControl) {
        >             mx.controls.Alert.show('CTRL + c');
        >             getURL("_javascript_:self.close();" <_javascript_:self.close();> );
        >         }
        >         lastKeyPressedControl = Key.isDown(Key.CONTROL);
        >     }
        >     Key.addListener(keyListener);   
        > }
        >
        > Other shortcut keys I've checked for are recognized and their
        actions carried out... why does this one not work properly?
        >
        > Thanks in advance.
       
       
       
       
       
       




--
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


        *        Visit your group "flexcoders <http://groups.yahoo.com/group/flexcoders> " on the web.
         
*        To unsubscribe from this group, send an email to:
         [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
         
*        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .


________________________________



--
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




Reply via email to