A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: close an html window with a button..?

  1. #1
    Junior Member
    Join Date
    Feb 2001
    Posts
    26

    Thumbs up

    is it possible to close an html window with a button, if the button is from a (loadmovie) swf file? or do i need to put that exit button in the main swf and not in a loaded movie file?

  2. #2
    Registered User
    Join Date
    Nov 2000
    Posts
    122
    use the get url

    getURL ("javascript:closewin");

    and in your html head make a javascript function called closewin


    window.close();

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Posts
    26
    feel a bit stupid asskin this, but could you please post the javascript code for the html that i need to paste into the page head...?

  4. #4
    Junior Member
    Join Date
    Apr 2001
    Posts
    28

    Code:
    <script language="javascript">
    <!--
    function closewin() {
        window.close();
    }
    //-->
    </script>
    there ya go..

  5. #5
    Junior Member
    Join Date
    Feb 2001
    Posts
    26
    well, i aparently is going to the java, but instead of closing the window, it loads a page with:
    ... function closewin() {
    window.close();
    }
    and the java function in the IE address line....
    any suggestions?

  6. #6
    Registered User
    Join Date
    Nov 2000
    Posts
    122
    ok:
    your button needs this code:
    ---------------------------------------

    on (release) {
    getURL ("JavaScript: closewin();");
    }


    ----------------------------------------
    and your html needs this javascript:

    ----------------------------------------
    <html>
    <head>
    <script language="javascript">
    <!--
    function closewin() {
    window.close();
    }
    //-->
    </script>

    </head>
    <body>


    </body>
    </html>
    ----------------------------------------

    it will prompt the user with a alert box saying the webpage you are viewing is trying to close a window!
    Do u want to close this windo -- yes? no?


    this is normal...from what i know it s impossible to do it without this thing to pop up...for security reasons...
    annyway hope it helps....




  7. #7
    Junior Member
    Join Date
    Feb 2001
    Posts
    26

    Smile

    YES! thank you!
    and the 'do you really wanna close windows' thing is great cause it'd worked into my design...

    oh, and by the way... if the button with the actionscript is in a loaded movie, and the javascript is in the main html that contains the flash that contains the (loaded) movie, the command still works!! (this ALSO works into my design)

    so thank you again for all your help!!

  8. #8
    Registered User
    Join Date
    Nov 2000
    Posts
    122
    cool...

    can i see it????



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