0 Replies Latest reply on Oct 10, 2007 8:13 AM by gafman

    Send event to shockwave from website

    gafman Level 1
      I've been trying to find a way of sending a shockwave client embedded in a website some kind of event (calling a method for example) but I'm now completely out of ideas.

      We've done it in Flash before using the code below, but is there any way I can use this method by importing the Flash movie and having the website send the imported movie events then using .setCallBack() within Director to catch the event?

      Is there another smart/friendlier way?


      ---------- Flash Code ------------------
      import flash.external.*;

      var instance = null;
      ExternalInterface.addCallback("setLabel", instance, function (str)
      {
      _root.setTextLabel(str);
      });

      function setTextLabel(str)
      {
      customLabel.text = str;
      } // End of the function

      -------------- Javascript Code -----------
      <script>
      function getFlashMovieObject(movieName)
      {
      if (window.document[movieName])
      {
      return window.document[movieName];
      }
      if (navigator.appName.indexOf("Microsoft Internet")==-1)
      {
      if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName];
      }
      else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
      {
      return document.getElementById(movieName);
      }
      }

      function setMyLabel(str)
      {
      getFlashMovieObject("connector").setLabel(str);
      }
      </script>

      <input type="button" value="Click" onClick="setMyLabel('Changed from javascript');"/>