April 20, 2001 - Autostarting an SWF | 3 | WebReference

April 20, 2001 - Autostarting an SWF | 3

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

Yehuda Shiran, Ph.D.
Doc JavaScript

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:

      <SCRIPT SRC="flashsound.js"></SCRIPT>
        var mySoundObj = new FlashSound();
      mySoundObj.autostart = true;

    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