Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Stop sound script?
07-29-2002, 05:48 AM #1
- Join Date
- Jul 2002
- Thanked 0 Times in 0 Posts
Stop sound script?
I am working in Dreamweaver and I have embeded a sound to play when the page loads. I want to use an image as a button to allow the user to stop the sound. Is this possible? Would it be easier to just use java for the whole sound load/sound stop business?
Sorry to ask such a simple question, this is much easier in Flash with the stop sound command.
07-29-2002, 08:36 AM #2
- Join Date
- Jun 2002
- Thanked 256 Times in 252 Posts
i downloaded this script somewhere...
Add this script to you page at the bottom right before the closing body tag:
(document.all) ? snd.src=document.embeds[x].src : document.embeds[x].play()
(document.all) ? snd.src="" : document.embeds[x].stop()
var audioStr='<bgsound id="snd" />\n'
for (var i in audio)
audioStr+='<embed name="audio'+ i +'" src="'+ audio[i] +'" autostart="false" hidden="true" />\n'
Then your links would look like this:
<a href="stuff.htm" onmouseover="playSound(1)" onmouseout="stopSound(1)">stuff</A>
with the above example you would hear sound2.wav whent he mose moves over the link and will stop when it moves out.
To have more than the two sounds add all the sounds you want to choose from here:
Just put as many songs in there as you like an remeber that they go in order like this:
so with the above example if my link said:
playSound(3) it would play moresongs.wav