Stop sound restarting main timeline

I have started a music file with Group 1 / Start button and want to create a toggle pause / play with another button (Sound) but the Sound button on mouse click restarts the Main timeline??

How can I fix this?

Thank you.

BD1 (1.4 MB)

Moved the “Sound” button above the first “Group1” and it worked “properly” - sound stopped & no timeline restart.


Brilliant! And do you know how I can make the Sound a toggle? I tried adding Play sound underneath and it stops it and starts up immediately.


Hype Demo: BD1 2 (926.0 KB)

Note: This Demo uses your approach of triggering sounds (Play, Stop) in the Hype interface.

One (of many) techniques is to have two buttons, one (Start) on top of the other (Stop). In the attached demo clicking on the “Start” button triggers the function “hideStartBtn” which runs a one line script that hides the “Start” button and reveals the “Stop” button underneath (and also plays a sound via the “On Mouse Click” of the Hype interface): = "none";

The “Start” button is referenced here as “element” - that is the element that initiated the script (via a mouse click).

Clicking on the “Stop” button triggers the “showStartBtn” function which displays the “Start” button again (the sound is stopped via the “On Mouse Click” of the Hype interface):

startButton = hypeDocument.getElementById('startBtn'); = "block";

More information about the “display” property is here.

Note: The “Start” button will always start the soundtrack from the beginning with this set-up no matter where it is stopped by the “Stop” button.

A “Play” ~ “Pause” arrangement (sound starts from the beginning or the point where it was paused) would be a different approach using code only… not the “Play Sound”~“Stop Sound” of the Hype interface.

Read this article for more information on scripting audio in Hype. HIGHLY recommended!

As I mentioned at the beginning of this post there are many techniques to create this toggling type of set-up, one version of which can use just a single button.

I think this is enough for now - somebody’s bedtime. :sunglasses::zzz: