spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column82


Embedding Sound with Flash, Part II: Playing Variations

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

Looping a Sound Track

The FlashSound JavaScript API supports several instance properties:

  • loop
  • autostart
  • playerID
  • bgcolor
  • base

The loop property tells the Flash player to re-trigger the track when the playhead reaches the end of the track. The SWF file should not include a stop label at the end of the track because it inhibits its looping, even if you specify loop=true before you embed the SWF file. The following two links point to two pages with similar code. The left one points to a page with loop=true embedding, while the right link points to a page with loop=false embedding. Try them both:

loop=true   loop=false

Here is the code for the left link:

<HTML>
<HEAD>
  <SCRIPT SRC="flashsound.js"></SCRIPT>
  <SCRIPT>
    var mySoundObj = new FlashSound();
  </SCRIPT>
</HEAD>
<BODY>
<SCRIPT>
  mySoundObj.loop = true;
  mySoundObj.embedSWF("theme.swf");
</SCRIPT>
</BODY>
</HTML>

Notice the loop=true assignment. You assign instance properties before you embed the SWF file by embedSWF(). The right link above is the same as the left link, except that the loop parameter is false. Notice that the sound loops forever in the left link, but stops after one round in the right link.

Also important to remember the fact that not every sound track can be made to loop. In fact, most SWF files are not suitable, because they contain a stop label at the last frame.

Next: How to autostart a sound track

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


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/9.html