April 13, 2001 - Piling Up Sounds | WebReference

April 13, 2001 - Piling Up Sounds

Yehuda Shiran April 13, 2001
Piling Up Sounds
Tips: April 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Flash has four different sync options: event, start, stop, and stream. You assign the type of the sound during editing. In this tip we discuss the event sync.

With event sync, Flash can play multiple copies of the same sound at the same time. It replicates itself while it is currently playing. This replication is often referred to as a new "instance" of the same sound. If you re-trigger an event sound while it is playing, it does not stop, rewind, and restart the sound. Instead, you get layering of multiple instances of the same sound playing at the same time.

As a reminder, in order to sonify your page, follow this recipe:

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
  • onmouseover event handler to the TGotoAndPlay() method.

    The following link plays a scale passage when moused over. Quickly mouse the link over and over again. A new instance starts every time you mouse over the link, creating a pile up of multiple instances. Try it:

    Play a Scale

    Here is the source code:

      <SCRIPT SRC="flashsound.js"></SCRIPT>
        var mySoundObj = new FlashSound();
    <P><A HREF="javascript://" onmouseover="mySoundObj.TGotoAndPlay('/scale-event', 'start')">Play a Scale</A>

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

    Download flashsound.js

    Download scale.swf