May 31, 2001 - Rewinding a Flash Movie
May 31, 2001 Rewinding a Flash Movie Tips: May 2001
Yehuda Shiran, Ph.D.
|
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.
autostart
parameter to false
. The OBJECT
tag looks like this in the include file flashmoviecheck.js
:
document.writeln(
'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
'codebase="https://active.macromedia.com/flash2/cabs/swflash.cab#version=4,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:
window.document.sonify.Rewind();
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 swift3d.com:
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>
<SCRIPT LANGUAGE="JavaScript">
Flash_embedSWF("swift3d.swf");
var mySwf = window.document.sonify;
</SCRIPT>