A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Close Window

  1. #1
    LearnFlash.com
    Join Date
    Jun 2005
    Posts
    14

    Close Window

    How do I close a browser window from my flash file? I've tried the following actionscript on my exit button, but it's not working:

    on (release) {
    getURL("javascript:window.close();");
    }

    Am I supposed to add something to the html file, too? And if so, what?

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    on (release) {
    getURL("javascript:self.close();");
    }

    And of course, never test this from test movie. A lot of java scripts can lock it up, so only test from the generated html page the movie is in.

  3. #3
    LearnFlash.com
    Join Date
    Jun 2005
    Posts
    14
    That's not working either. And I AM testing it in a browser window.

  4. #4
    LearnFlash.com
    Join Date
    Jun 2005
    Posts
    14
    Okay, it's working in IE, but is there a way to get it to work in Firefox?

    Also, is there a way to fix it so that the dialogue box asking you if you want to close the window doesn't show up?

  5. #5
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Works fine for me, I can even send the command with LocalConnection and it will work.

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    No, you get the dialog box if it's the only window open. Use this for popups. Why would you want to close the only open window anyway? Most people won't want to.

    Firefox has it's own way of doing things. I don't use it, so I don't know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center