5 Replies Latest reply on Jul 3, 2007 3:56 PM by crazyjoemilan

    How to use ExternalInterface

    retrobadger
      I'm trying to use ExternalInterface in a project, put simply I am trying to have an html button run a flash function, nice and simple, or so I thought. It just refuses to work, I think there is just no connection to flash being made, can anyone give me some advice please!

      Cheers
      Dan

      // THE JAVASCRIPT
      var thesideflash;

      function flashvarInit()
      {
      if(navigator.appName.indexOf("Microsoft") != -1)
      {
      thesideflash = window.flashObject;
      }else{
      thesideflash = window.document.flashObject;
      }
      }

      function runfunction()
      {
      thesideflash.testfunction();
      }

      // THE FLASH
      import flash.external.ExternalInterface;
      ExternalInterface.addCallback("testfunction", this, testfunction);
      testfunction = function()
      {
      .............
      }

      // THE HTML
      <li><a href="#" onmouseover="runfunction();">test</a></li>