0 Replies Latest reply on May 14, 2007 2:53 AM by epasi

    ExternalInterface.call problem calling Javascript

    epasi
      I can't get work my SWF calling a javascript function in my web page (ASPX)

      this is the code that i use to show the SWF :
      ------------------------------------------------------------------------------------------ ------------------
      function RunClip(idMap)
      {
      var Larghezza = 1024;
      var Altezza = 768;
      var clip = "supervisore.swf?idMap="+idMap;
      var allowScriptAccess = "always";
      var allowNetworking = "all";
      document.write("<DIV id=\"flash\" style=\"z-index:2\">");
      document.write("<object name=\"flashObject\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" "+
      " codebase=\" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" "+
      " width=\""+Larghezza+"\" height=\""+Altezza+"\" align=\"middle\">");
      document.write("<param name=\"allowScriptAccess\" value=\""+allowScriptAccess+"\" />");
      document.write("<param name=\"allowNetworking\" value=\""+allowNetworking+"\" />");
      document.write("<param name=\"movie\" value=\""+clip+"\"/>");
      document.write("<param name=\"quality\" value=\"high\"/>");
      document.write("<param name=\"wmode\" value=\"opaque\"/>");
      document.write("<embed src=\""+clip+"\" quality=\"high\" width=\""+Larghezza+"\" height=\""+Altezza+"\" "+
      " align=\"middle\" play=\"true\" loop=\"false\" "+
      " type=\"application/x-shockwave-flash\" quality=\"high\" "+
      " allowNetworking=\""+allowNetworking+"\" "+
      " allowScriptAccess=\""+allowScriptAccess+"\" "+
      " pluginspage=\" http://www.macromedia.com/go/getflashplayer\" />");
      document.write("</object></DIV>");
      }

      THIS IS ACTIONSCRIPT (title is always 'null')
      -----------------------------------------------------------------------------------
      var title:String = ExternalInterface.call("JsFunction","test");

      THIS IS THE JAVASCRIPT function
      -----------------------------------------------------------------------------------
      <head runat="server">
      <title>Test</title>
      <script language=javascript>
      function JsFunction(variable) {
      return variable;
      }
      </script>.....
      <body onload="hide();" onclick="hidemenu();">

      <form id="form1" runat="server">
      <DIV id="outer" style="z-index:1">
      <script type="text/javascript">RunClip(1);</script>
      </DIV>......