0 Replies Latest reply on May 29, 2007 7:54 AM by JaeWebb

    AS2 Flash Movie Call to JavaScript Function Works in Firefox, Doesn't Work in IE6, IE7

    JaeWebb
      I have a Flash 8 (actionscript 2.0) movie advertisement that exists inside a floating html div controlled by javascript. When you click an html link in the div ('X', top left corner), a javascript function called 'disappear()' is triggered, which makes the advertisement div and the flash movie inside it disappear, as the function name suggests. My goal is to call the same disappear() function from inside the flash movie instead. I've created the code; the actionscript exists on the button itself.

      I've tested the disappear function in the link for IE6, IE7, and Firefox. It works in all three. I believe it works in Safari as well.

      When I test the function called from inside the Flash movie, it works in Firefox. The problem is that IE6 is blocking the javascript call; my cursor responds as if the close_btn (close button) is a link, but nothing happens.

      Please help me figure out a way to get around IE6 blocking the js call from Flash and ensure that the call works in all browsers, same as it does in the regular html link calling the same function. I'd prefer the solution come from actionscript, but if it must come on the javascript side, I'll take what I can get. To debug, all you need is a 500 x 300 flash movie with a close button and the following code:

      ---------------------FLASH BUTTON (closeHTML_btn; instance of close_btn)---------------------

      on(press){
      getURL("javascript:disappear();"); //
      }

      ---------------------HTML/JAVASCRIPT PAGE---------------------

      <html>
      <head>

      <script>
      var timeout;
      function appear(){
      var the_style = getStyle("floatingflash");
      if (the_style) {
      var current_top = parseInt(the_style.top);
      var new_top = current_top + 5;
      if (document.layers) {
      the_style.top = new_top;
      } else {
      the_style.top = new_top + "px";
      }
      if (new_top < 150) {
      the_timeout = setTimeout('appear();',10);
      }
      }
      } // appear
      function disappear() {
      var the_style = getStyle("floatingflash");
      the_style.display = 'none';
      } // disappear
      function getStyle(ref) {
      if(document.getElementById && document.getElementById(ref)) {
      return document.getElementById(ref).style;
      } else if (document.all && document.all(ref)) {
      return document.all(ref).style;
      } else if (document.layers && document.layers[ref]) {
      return document.layers[ref];
      } else {
      return false;
      }
      } // getStyle
      </script>
      <style>
      #floatingflash {
      position:absolute;
      border:1px solid red;
      background:white;
      }
      </style>
      </head>
      <body onload="appear();">
      <div id="floatingflash" style="top:-400px;left:-150px;margin-left:50%;">
      <a href="javascript:disappear();">X</a>
      <p>  </p>
      <p>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="500" height="300" title="Hover Ad">

      <param name="movie" value=" http://------------------------------/500x300.swf" />
      <param name="quality" value="high" />
      <embed src="Quest500x300.swf" quality="high" pluginspage=" http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="500" height="300"></embed>
      </object>
      </p>
      <p><a href="launch.html">Back</a></p>
      </div>
      </body>
      </html>