This animation is on a course page, by using the numbered/arrow buttons you change the content BUT you don’t ever actually reload the browser page itself. So the issue here is that longer/looped sounds from various animations will continue to play even when the course page content has changed (unfortunately removing looped/longer sounds is not an option).
I need a way of muting audio files on the course pages by clicking on these buttons, on some pages there are multiple animations. I’ve read through various other topics on here about ways of muting sounds but none of them are applicable for my scenario.
Hope this is clear enough, i’m open to any ideas you’ve got!!
It would help to see the external document and what you are doing.
I assume you are using the methods from here;
So if I understand you correctly the easiest thing maybe to add a stopAudio timeline with the keyframe actions to stop the audio.
Then make two calls on the onclick.
<a href = "#" onclick = "HYPE.documents['TypeText'].startTimelineNamed('stopAudio');HYPE.documents['TypeText'].showSceneNamed('scene2')">Jump To My Scene</a>
This works in my tests.
On a side note, I have possibly an easier way for you to set up the typed text.
The way I would do this is to create three timelines, one for each typed text section.
Then the other two action down stream to start the bell sound and stop the typewriter sound.
repeat this for the other text red numbers and sound starts and stops in two more timelines. ( including the JS function )
The Main Timeline will start these timelines at the correct times.
The JS function is an adaption of my Type Text code.
This adaption uses the name of the timelines to work out which text to start typing.
So the three timeline are named
The big text boxes then get an id that matches it’s timeline.
In the JS function you then add three arrays.
Each array contains two items.
Item 1 will be the text to type, item two will be the speed to type it.
Each array will get a corresponding global variable name.
We can now use the name of timeline calling the JS to choose the correct array by joining the timeline name with “CharArray”.
We also use the time line name to get the Text box that whose id matches it.
Here is the working example.
My thoughts are that this will save time constructing the typing on a timeline and innerText properties.
All you then need to do is setup the Actions to start the text timelines at the right time, work out the speed for the text to type for each section. ( this was very easy to do for me, I just went up or down 20 milliseconds on the numbe in second item in the text arrays)