Embedding Sound with Flash, Part II: Playing Variations: Playing Multiple Instances - Doc JavaScript | WebReference

Embedding Sound with Flash, Part II: Playing Variations: Playing Multiple Instances - Doc JavaScript


Embedding Sound with Flash, Part II: Playing Variations

Playing Multiple Instances

When you edit a Flash file, you can choose how the sound track synchronizes with other instances of the same sound track. You can opt, for example, that the sound track will play in parallel to other instances. You can decide, on the other hand, that only one instance can play at any one moment. These options are called sync options. Flash has four different sync options: event, start, stop, and stream. You assign the type of the sync during editing. 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.

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 code for the above link:

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

Next: How to smooth track transitions

http://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: April 23, 2001
Revised: April 23, 2001

URL: http://www.webreference.com/js/column82/3.html