May 31, 2001 - Rewinding a Flash Movie | WebReference

May 31, 2001 - Rewinding a Flash Movie

Yehuda Shiran May 31, 2001
Rewinding a Flash Movie
Tips: May 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

In some of your applications you may need to use Flash movies and JavaScript directly, without any prepackaged APIs such as FlashSound JavaScript API. You will enjoy more features, methods, and properties, but you'll have to take care of all the tiny details that are taken for granted when using FlashSound API, for example.

One of the "tiny" details is embedding the Flash object. The JavaScript file flashmoviecheck.js does exactly this, and other stuff. It also checks for Flash plug-ins, and minimum player version.

One of the problems of embedding Flash movies is that the movie starts automatically, even though we set the autostart parameter to false. The OBJECT tag looks like this in the include file flashmoviecheck.js:

    '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
'codebase=",0,0,0"' +
    'ID="sonify" WIDTH="100%" HEIGHT="100%">' +
    '<PARAM NAME="movie" VALUE="' + srcURL + '">' + 
    '<PARAM NAME="quality" VALUE="high">' +
    '<PARAM NAME="wmode" VALUE="transparent">'+
    '<PARAM NAME="autostart" VALUE="false">'+
    '<PARAM NAME="bgcolor" VALUE=' + bgcolor + '>' +

Notice the autostart parameter and its assigned value false. To overcome this problem, we added the following line as the last statement in Flash_embedSWF() function:


In this way, we rewind the SWF and stop it at the beginning of the track, ready to be played. Play around with the following SWF, courtesy of

Rewind | Play

Here is the source code:

<SCRIPT LANGUAGE="JavaScript" SRC="flashmoviecheck.js"></SCRIPT>
<A href="javascript://" onclick="javascript:mySwf.Rewind(); return false">Rewind</A></FONT> | 
<A href="javascript://" onclick="javascript:mySwf.Play(); return false">Play</A></FONT>
  var mySwf = window.document.sonify;