1

i want to close the web page when user click the button in the flash.this is the code i used

        public static function close():void{
//          ExternalInterface.call("window.close()");
            navigateToURL(new URLRequest("javascript:window.close();"),"_self");
        }

this approach seems out of date nowadays. it only works for local page,use file:/// to access,but access it in a remote way,the code didn't give me a **,not even throw a security error.What do i suppose to do?

user2003548
  • 4,287
  • 5
  • 24
  • 32

1 Answers1

2

UPDATE:

This regretfully does not help with the firefox. The issue is not in actionscript, but in the way how the firefox handles the window.close() function. You can simply replicate this by trying to call window.close() directly from javascript without any actionscript. It is a security restriction. There are some related questions, answers and possible solutions here:

Close windows that were not opened by script using javascript

and here:

How can I close a window with Javascript on Mozilla Firefox 3?

END OF UPDATE


I am sure this is a security issue. Have a look in the console, isn't there something similar to the following?

Scripts may not close windows that were not opened by script. @ javascript:window.close();

I suggest to create a function in javascript which would close the window and call this function using external interface. Something like this:

JS:

function closeWindow() {
   ...
}

AS:

if(ExternalInterface.available) {
  ExternalInterface.call("closeWindow");
}
Community
  • 1
  • 1
mara-mfa
  • 895
  • 6
  • 9