Button click duration

Hi!

I just try to use a Button to use for a MorseCode. I read already in different topics how to use JavaScript to click in order, but i want to use just one Button to press short or long.
Is this type of click/press possible? Or has it to be done with JavaScript?

Thanks.

You can run a function to detect how long something has been pressed by using a timeline’s playback duration:

longpress.zip (29.0 KB)

In this example, I have a timeline run when I hold on an element, and when I release my hold, I detect how long that timeline has run:

hypeDocument.currentTimeInTimelineNamed('HoldTimeline')
var PressDuration = hypeDocument.currentTimeInTimelineNamed('HoldTimeline');
if (PressDuration >= 3) {
	alert('long press');
	// you could run a timeline here?
} else {
	alert('short press');
	// or do some other function here...
}
3 Likes

Hi Daniel, thanks for your quick solution. it works great.