First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Gonzalo Alustiza

Linking page elements to sounds

This is the easy part, if you read through this document you have your invisible frame, your web page inside the invisible frame that embeds the Flash Movie, the Flash Movie with sounds as Movie Clips, your JavaScript code library and the web pages that you want sonified.

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:

a. Reference the JavaScript library ‘soundtown.js’ from HTML like this:

    <script SRC="soundtown.js">

    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 don’t 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

Added: 2001-02-20
Rating: 5.83 Votes: 30
(10 being the highest)
» Author
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
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.