Linking page elements to sounds
Now we will see how to create the event handlers needed to sonify links and/or images.
To use the sound function from a web page:
It is important (as I said before) that you reference the external library from every web page that will have sounds so the sound functions are available to be called from event handlers.
b. Insert the function call inside a onmouseover event handler like this.
<a href="agenda.htm" onmouseover="sound(event,'true');" target="principal"><img border="0" src="images/m_agenda.gif" width="65" height="43" name="m_agenda"></a>
When the onmouseover event fires, it will call the function and the sound will start.
If you want the sounds to stop when the user moves the mouse pointer away from the link and/or image you can add a function call to a onmouseout event. Like this:
Onmouseout="sonido(event,'');" Notice the play flag as an empty string
In this case, the sound inside the Movie Clip will stop. It really is a matter of taste, I mean, if you want sounds to bleed into each other dont use the onmouseout event. Personally I think that stopping sounds when the user leaves the link and/or image allows a much controlled sound experience, but again, it is a matter of taste.
|» Level Intermediate|
Rating: 5.83 Votes: 30
|My name is Gonzalo Alustiza and I work as a chief developer at Soundtown Argentina. Soundtown is a ten year old music production company specializing in music for advertising and TV which started to develop sonification solutions for the Internet.|
|Download the files used in this tutorial.|
|Download (89 kb)|
|More help? Search our boards for quick answers!|