Skip to main content
Participating Frequently
March 26, 2009
Question

timer

  • March 26, 2009
  • 1 reply
  • 264 views
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?
This topic has been closed for replies.

1 reply

Ned Murphy
Legend
March 26, 2009
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);
}