#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    12
    Rep Power
    0

    closeing a javascript window with flash


    I am trying to close a JavaScript window with Flash. This is what i am doing. When you click on a button in the master flash movie it pops open a new flash movie in a JavaScript window. I am trying to use JavaScript through flash to close this window. I have tried many different ways to do this, but to no avail. If anyone could help me it would be great, or have any suggestions on how to do this easier.

    here is my code:

    Flash (the master movie that opens the image movie)
    photo.swf = on (release) {
    getURL ("javascriptpenWindow('sur1.html','myNewWindow', 'width=400, height=423')");
    }

    ============================================

    Flash (the image movie)
    sur1.swf = on (release) {
    getURL("javascript:close()");
    }

    ============================================

    HTML(the base HTML file that calls the master movie into play)
    index.html = function sur1Window() {
    var iMyWidth;
    var iMyHeight;

    iMyWidth = (window.screen.width/2) - (385 + 10);
    iMyHeight = (window.screen.height/2) - (150 + 50);
    var win = window.open("sur1.html","vanchadwick","width=400,height=424,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0 ,status=0,toolbar=0,");
    win.focus();
    }

    function close() {
    parent.close;
    }
    <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" onLoad = close()>

    =============================================

    HTML(this is the master movie, it controles frame rate, size, pretty much everything, and all movies answere to this page for JavaScript functions)
    master.html = <script language="javascript">
    <!--
    function openWindow(URL, windowName, windowProperties) {
    newWindow=window.open(URL,windowName, windowProperties);
    }
    function close() {
    parent.close;
    }
    //-->
    </script>

    </HEAD>
    <BODY bgcolor="#FFFFFF" leftmargin="0" topmargin="0" onLoad = close()>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    imho your best choice would be the FSCommand interface.

    your flash movie tag ("object" or "embed") has a name tag. letīs say it is
    name="movie1"
    for now. then you make a java script function like this:
    Code:
    <head>
    <script language="JavaSxript">
    <!--
    var win;
    function movie1_DoFSCommand(command, args) {
      switch (command) {
        "close":
          win.close();
        break;
        "open":
          win=window.open("...");
        break;
        else:
          alert("Unknown FSCommand: "+command);
      }
    }
    //-->
    </script>
    </head>
    ...
    in your flash movie you call the FSCommand() function instead of getURL() and pass "open" or "close" as command. do you get the point?

IMN logo majestic logo threadwatch logo seochat tools logo