1 Reply Latest reply on Jun 5, 2006 9:51 AM by blemmo

    Navigating after inactivity

    Ross Trewhella
      Hi,

      Inside my flash presentation I want to go to a pre-defined Scene/Frame after a period of user inactivity (i.e. no keyboard inputs or mouse movements). In other words it will act as a form of screensaver whereby if the user is not using the presentation it will show something pretty.
      I am using Flash MX 2004.
      Any ideas?
      Ross
        • 1. Re: Navigating after inactivity
          blemmo Level 1
          Hi,

          this is adapted from another thread (search the forum for 'activity', it's the 2nd that comes up):
          --
          if (!timeoutID) {
          var timeoutID = setInterval(timedOut, 10000);
          }
          function timedOut() {
          clearInterval(timeoutID);
          trace("timeout");
          }
          var myListener bject = new Object();
          myListener.onKeyDown = myListener.onMouseMove = function () {
          clearInterval(timeoutID);
          timeoutID = setInterval(timedOut, 10000);
          };
          Key.addListener(myListener);
          Mouse.addListener(myListener);
          --
          Place this code in frame 1 of your movie, and you're done. In the function 'timedOut', change the trace("timeout") line to the code you want to have executed, e.g. gotoAndPlay("screensaver").

          greets,
          blemmo