spacer
Yehuda Shiran April 20, 2001
Autostarting an SWF
Tips: April 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Eclipse Helios Update Brings New PHP Tools
Internet Explorer 9 Ups Standards Support
JBoss Portal 5 Release Easier to Use

The FlashSound JavaScript API supports several instance properties. The autostart property tells the Flash player to start the sound immediately after embedding it in the page. In this case you don't need any link to click or mouse over, as the sound will start automatically. As a reminder, 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 or onmouseover event handler to the TGotoAndPlay() method.

The following two links point to two pages with similar code:

autostart=true   autostart=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.autostart = true;
  mySoundObj.embedSWF("theme.swf");
</SCRIPT>
</BODY>
</HTML>

Notice the autostart=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 autostart parameter is false. Notice that the sound autostarts in the left link, but, in order to start the sound on the right link, you need to mouse over a link.

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

Download flashsound.js

Download theme.swf


People who read this tip also read these tips:

Look for similar tips by subject:

webref The latest from WebReference.com Browse >
Flashmaps' DynamicLocator: Interactive Maps for Small Areas · Flashmaps' AreaSelector: Interactive Maps for Wide Areas · The DB Mapper: Interactive Street-level Maps of U.S. and Canada
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags