As an alternative to using Flash, there are good and efficient ways to use sounds in your Web pages...
...whether it's for bg sounds/music, or for sounds heard when a button is clicked on. The following mini-tute runs through how to setup this function in your pages.
Here's the script/code you need for your project, and below that is a link to a DogPile search page where you can learn more about this stuff (take note of what keywords i used in the search box).
(replace the following sound file names)
In the HEADER of your document, put this code:
This will loud a desired mp3 file in the bg of the document when the page is called. This can be used either alone, or in conjunction with the following button sound effect.Code:<bgsound src="oompaloompa.mp3">
In your document, put this code into the HEADER section:
And here's what the html link code would be on your page: (replace the link url & link text)Code:<script language="JavaScript" type="text/javascript"> <!-- function playSound(soundobj) { var thissound= eval("document."+soundobj); thissound.Play(); } --> </script> <embed src="click.wav" autostart="false" hidden="true" name="mySound">
If you want the sound to be activated by a mouse click, then replace the onMouseOver above with onClick.Code:<a href="oompaloompa.html" onMouseOver="playSound('mySound')">Play My Sound!</a>
The coolest thing about this method is that by having the sound called through a mouseOver, instead of a click, you make sure the sound gets played before the clicked link can leave the current page.
Just make sure you do 2 extra things for this:[list]1) Make your button sound effect very small in file size -- i.e. no more than 6kb if possible. Use 11khz and 16bit mono for your wav settings.
2) Use a preLoad script to load the sound file when the page loads, so that it'll be ready to go as soon as a button gets clicked.[/list:u] Let me know if you have any trouble with this. Just read carefully though and it should be fairly easy to pull off.
Have fun!
Checkout this page for more learnin'.
http://www.dogpile.com/info.dogpl/se...2Bplay%2Bsound



LinkBack URL
About LinkBacks




Reply With Quote