3 Replies Latest reply on Apr 30, 2006 9:17 AM by kglad

    inactivity times

    Level 7
      I would like to build a timer that counts down and triggers a timeline
      action once it gets to 0. Everytime the user clicks on anything inside
      that file, the timer would reset itself and start over. So as long as
      there is activity, it would not get to the end, but if the user would
      abandon the file, it would eventually reset itself.

      So I guess I am looking for two pieces of code. One the timer code and
      second something like a listener for activity or a release inside the file.

      Thank you for any help/suggestins with this!

        • 1. Re: inactivity times
          kglad Adobe Community Professional & MVP
          define timeLimit and try:
          • 2. Re: inactivity times
            Level 7
            kglad, thank you for your help! I put the AS you gave me in place and it
            seems to work, except for it does not seem to reset the timer when I
            move the mouse. So it times and does it's thing if time runs out, but it
            does not reset in case you do the mouse move.

            I modified the code you gave me a little bit, this is what I have at the
            moment. Any ideas why this is not working?

            Thank you so much for the help!

            startTime = getTimer();
            checkActivityI = setInterval(checkActivityF, 5000);
            var mouseListener bject = new Object();
            mouseListener.onMouseMove = function(){
            startTime = getTimer();
            trace("mouse was moved");

            function checkActivityF() {
            secondsOfInactivity = Math.round((getTimer()-startTime)/1000);
            timeUntilTrigger = timeLimit-secondsOfInactivity;
            if (secondsOfInactivity>=timeLimit) {
            // inactive trigger - do something
            trace("testing the timer");
            • 3. Re: inactivity times
              kglad Adobe Community Professional & MVP
              see your other thread.