Button with a "press-time restriction"


#1

Does anyone have any experience making a button that must be pressed for a certain amount of time before it performs an action?

I would really like to be able to set up a button that must be held down for over 5 seconds before it takes the visitor to another screen.


#2

Hi @cullenb,

I think you could build something easily by using the Countdown from our Time Interface Asset.

You can try:

  • WHEN Button is pressed
    • start Countdown
    • set a Variable “ButtonPressed” to True
  • WHEN Countdown = 0
    • AND “ButtonPressed” = True -> do something
  • WHEN Button is released
    • stop and reset Countdown, set variable “ButtonPressed” to False

You may want some visual cue for your user in order to let him know it has to press for some amount of time (a message, a bar filling, displaying the countdown value etc).

Regards,

Alex.

PS: as I made it while testing, I’m sharing the small sample with you :wink:

Community-TimedButton.zip (2.0 MB)


#3

Yes, that’s brilliant! I’d really like to understand how to build assets like this from scratch. Thanks very much, Alex. I really appreciate it.