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="" class="moz-txt-link-rfc2396E" href="_javascript_:self.close();">"_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();");
>         }

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();");
}

The "closeWin" popup is never fired. Any ideas? Is anyone else
successfully closing a window via a shortcut key combination?

--- In [email protected], "fowleryj" <[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();");
>     }
> }
>
> 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();");
>         }
>         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




Reply via email to