0 Replies Latest reply on Jul 31, 2009 11:42 AM by TerryCQ4

    Problem with window.close and window.open

    TerryCQ4

      I am having two suspected Actionscript problems which only seem to be happening with Flash player 9 and later.

       

      BACKGROUND:
      I have a client who needs browser-launched swf files to play from a CD-ROM (I do not want to use the Flash projector).  These files were created a few years ago using Actionscript 1 & 2 code and everything has worked perfectly until now.

       

      Here is the setup:

       

      1. First, an autorun file on the root of the CD runs and writes a 'trust file' to the 'Macromed' directory.  The autorun next launches 'index.htm' which is simply an html page containing a series of links (topic1.htm; topic2.htm; and so on).
      2. Next, let's assume the student clicks the 'topic1.htm' link from the 'index.htm' page.  The 'topic1.htm' link launches a web page (also located on the CD) which contains and displays 'topic1.swf'.  So far, everything works fine.

       

      Here is where the two problems happen.

       

      Problem 1:
      I have an 'Exit' button within each swf (remember each swf is contained inside an html page).  The 'Exit' button has always worked properly, but suddenly does not work in Flash player 9.  I am using the following Actionscript 2 code on the 'Exit' button:

       

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

       

      The 'Exit' button has always worked using this code (and still works in Flash player 8 and lower).  However, it does nothing when played using Flash player 9.


      Problem 2:
      There are links to html popup windows within the 'topic1.swf' file (remember 'topic1.swf' is contained inside 'topic1.htm').  Each popup window contains a swf file that is used to present a demonstration.  When the student clicks the 'demo1.htm' link from 'topic1.swf', an html popup window SHOULD load and display 'demo1.swf' inside the 'demo1.htm' window.  The main ('topic1.htm') window stays open so that the student can return to the topic after completing the demo.  This has always worked properly until Flash player 9.  Here is the Actionscript 2 code

      which I am using on the button inside 'topic1.swf' to launch 'demo1.htm':

       

      on (release) {
                  getURL("javascript:launchWin2('webpage2.html');");

      }

       

      ADDITIONAL INFO:
      'topic1.htm' contains the following code which is used to support the Actionscript code listed under 'Problem 2' above.

       

      <SCRIPT LANGUAGE=JavaScript>
      <!--
      var padvar="";
      var childwind;

      function launchWin2(arg) {
      openWin2(arg);
      }

      function openWin2(arg) {
      childwind = window.open(arg,"padwind2","menubar=no,location=no,status=no,scrollbars=no,width=750px,he ight=500px,left=0,top=0");
      }
      //-->
      </SCRIPT>


      I would appreciate any help anyone can offer.  I am wondering if the problem has to do with a need to use ONLY Actionscript 3 code from Flash player 9 onwards.

       

      Thanks!
      Terry