April 23, 2001 - Finding FlashSound Object ID
April 23, 2001 Finding FlashSound Object ID Tips: April 2001
Yehuda Shiran, Ph.D.
|
playerID
. The playerID
is in the form of "FlashSound_swf"
plus an index starting at 0. For example, the first SWF embedded on the page with embedSWF()
has playerID
of "FlashSound_swf0"
, and the second would be "FlashSound_swf1"
.
As a reminder, in order to sonify your page, follow this recipe:
flashsound.js
in the HEAD
section. Download.
HEAD
section.
BODY
section.
onmouseover
event handler to the TGotoAndPlay()
method.
The following links alert their respective sound instance's playerID
. Mouse over the left one. Its playerID
should be FlashSound_swf0
. The playerID of the middle and right links is FlashSound_swf1
. Try mousing over these links to trigger the alert boxes:
Play a Scale Start a Looping Sound Stop a Looping Sound
Here is the source code:
<HTML>
<HEAD>
<SCRIPT SRC="flashsound.js"></SCRIPT>
<SCRIPT>
var mySoundObj1 = new FlashSound();
var mySoundObj2 = new FlashSound();
</SCRIPT>
</HEAD>
<BODY>
<A HREF="javascript://" onmouseover="mySoundObj1.TGotoAndPlay('/scale-event','start');
mySoundObj1.TGotoAndPlay('/scale-event','stop');
alert(mySoundObj1.playerID)">Play a Scale</A>
<A HREF="javascript://" onmouseover="mySoundObj2.TGotoAndPlay('/loop-event','start');
alert(mySoundObj2.playerID)">Start a Looping Sound</A>
<A HREF="javascript://" onmouseover="mySoundObj2.TGotoAndPlay('/loop-event','stop');
alert(mySoundObj2.playerID)">Stop a Looping Sound</A>
<SCRIPT>
mySoundObj1.embedSWF("scale.swf");
mySoundObj2.embedSWF("loop.swf");
</SCRIPT>
</BODY>
</HTML>
Here are links you can use to download flashsound.js
, loop.swf
, and scale.swf
: