1 Reply Latest reply on Mar 26, 2009 4:43 AM by Ned Murphy

    timer

    tobycraftse
      I have 3 flash button, and a touch screen LCD.

      how can I detect if user has touch + hold the button for 5 seconds?

      how to use timer + mouse down + mouse up for this?

      1) mouse down
      2) start timer (count 5 sec)
      3) mouse up
      4) user hold button for 5 sec detect

      how to code this in actionscript?
        • 1. timer
          Ned Murphy Adobe Community Professional & MVP
          Use getTimer() along with a variable or two.

          var startTime;
          var pressTime;

          btn.onPress = function(){
          startTime = getTimer();
          }

          btn.onRelease = function(){
          pressTime = (getTimer() - startTime)/1000; // divide by 1000 to get seconds

          trace(pressTime);
          }