5 Replies Latest reply on Mar 18, 2008 7:25 AM by Greg Dove

    Using ExternalInterface

    gandalf458 Level 1
      I have a web page with a few timers on and added the JavaScript onbeforeunload method to warn users they may lose information if they navigate away from the page. However, if they haven't started a timer it would be better not to use this and so I have added the following to the Start button ActionScript

      if (ExternalInterface.available) {
      ExternalInterface.call("running");
      }

      My JavaScript is

      function unloadMsg() {
      msg = "You may have a timer running."
      return msg;
      }

      function setUnload(on) {
      window.onbeforeunload = (on) ? unloadMsg : null;
      }

      function running() {
      setUnload(true);
      }

      However, it doesn't seem to be working. Can anyone give me an idea where I'm going wrong please?