April 11, 2001 - Ringing a Link | WebReference

April 11, 2001 - Ringing a Link

Yehuda Shiran April 11, 2001
Ringing a Link
Tips: April 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

An excellent way to give even a better feedback to the user when clicking a link, is to sound a ringing sound. You can do it easily with Flash. In order to sonify your page, follow this recipe:
  • Make sure you have the Flash player. 96% of the surfing population already has it. Download.
  • Include
flashsound.js in the HEAD section.
  • Create a flashsound object in the
  • HEAD section.
  • Embed your swf file in the
  • BODY section.
  • Create an anchor tag and set the
  • onclick event handler to the TGotoAndPlay() method.

    Here is an example that plays a funky music which you can fade and stop:

    Ring Me

    Here is the source code:

    <HTML>
    <HEAD>
      <SCRIPT SRC="flashsound.js"></SCRIPT>
      <SCRIPT>
        var mySoundObj = new FlashSound();
      </SCRIPT>
    </HEAD>
    <BODY>
    <P><A HREF="javascript://" onclick="mySoundObj.TGotoAndPlay('/ringsound', 'start')">Ring Me</A>
    <SCRIPT>
      mySoundObj.embedSWF("ringover.swf");
    </SCRIPT>
    </BODY>
    </HTML>

    Here are links you can use to download flashsound.js and ringover.swf:

    Download flashsound.js

    Download ringover.swf