The function will be called sound and will take two
arguments:
An event object. This is an object.
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:
First detect the browser. This will help to branch the code to
support NE and IE.
Using the Event object, retrieve the URL that is referenced by the
HTML tag that called the function upon an event.
Use a JavaScript Regular Expression to split the URL you retrieved
and pick up the part youll 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.
Check if the play flag equals true if the answer is yes,
see next step. Else see step f.
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.
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.
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.