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

The function will be called ‘sound’ and will take two arguments:

    1. An event object. This is an object.
    2. A play or stop flag. This argument is a string and can take a ‘true’ value or can be an empty string meaning ‘false’ or a different string meaning ‘false’ too.

The logic behind the function is as follows:

    1. First detect the browser. This will help to branch the code to support NE and IE.
    2. Using the Event object, retrieve the URL that is referenced by the HTML tag that called the function upon an event.
    3. Use a JavaScript Regular Expression to split the URL you retrieved and pick up the part you’ll use. In our case you will use the name of the HTML file without the .htm or .html extension in the same way you acted when giving names to the Movie Clips.
    4. Check if the play flag equals ‘true’ if the answer is yes, see next step. Else see step f.
    5. Once you have the name of the web page, instruct the Flash ActiveX control or plug-in to play the Movie Clip whose name matches with the web page.
    6. Stop the Movie Clip and move to its first frame.

Before diving into the code, I think that it is fair to note that it was tested only on the following browsers and platforms:

        Internet Explorer 5.5 on Intel PCs.

        Netscape Communicator 4.5 on Intel PCs.

        Netscape Communicator 4.7 on Power Macintosh.

No further testing of the code was performed since its writing (several months ago) so I am almost sure that this will break under Netscape 6 or older versions of each browser. Also keep in mind that as I said in the foreword, only the essential code is provided. It is up to you to tailor it to your needs. In fact the original code was much more complex but, it dealt with issues specific to the project it was developed for, so It has no place here.

» 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.