N
nola_dirigent
I've run into a problem trying to call a javascript function in a larger project that I'm working on. I've duplicated this problem with a simplified html and javascript page.
I'm trying to call a javascript function to play an embedded SWF file on 'onclick'. It works fine if I use an in-line javascript script call (the two links at the bottom of the html page) but I can't get it to work calling a function ( the button at the top of the page). The function seems to be finding the SWF id, but it's not playing. Ultimately, I need to transfer the function to a page where the SWF id (object) has been embedded with SWFObject 2.0. But until I can get past this hurdle, I can't go anywhere. I must be missing something rather basic here.
Any help would be appreciated.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function movie() {
var findMovie = document.getElementById('swfmovie');
if (findMovie){
findMovie.play();
} else {
alert ("Movie not found");
}
}
</script>
</head>
<body>
<p><input name="play" type="button" onClick="movie();" value="play"/><p>
<object classid="clsid
27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="219" HEIGHT="171" id="swfmovie" ALIGN>
<param NAME="movie" value="correct.swf">
<param NAME="quality" value="High">
<param name="Src" value="correct.swf">
<param name="WMode" value="Window">
<param name="allowScriptAccess" value="always" />
<param name="Play" value="false">
<EMBED src="correct.swf" quality=high bgcolor=#FFFFFF WIDTH="246" HEIGHT="187" NAME="swfmovie" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</object>
</p>
<p>
<a href="javascript:document.swfmovie.Play()"><font face="Arial">►</font>play </a> <font face="Arial">
<a href="javascript:document.swfmovie.StopPlay()">║pause</a></font></p>
<p> </p>
</body>
</html>
I'm trying to call a javascript function to play an embedded SWF file on 'onclick'. It works fine if I use an in-line javascript script call (the two links at the bottom of the html page) but I can't get it to work calling a function ( the button at the top of the page). The function seems to be finding the SWF id, but it's not playing. Ultimately, I need to transfer the function to a page where the SWF id (object) has been embedded with SWFObject 2.0. But until I can get past this hurdle, I can't go anywhere. I must be missing something rather basic here.
Any help would be appreciated.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function movie() {
var findMovie = document.getElementById('swfmovie');
if (findMovie){
findMovie.play();
} else {
alert ("Movie not found");
}
}
</script>
</head>
<body>
<p><input name="play" type="button" onClick="movie();" value="play"/><p>
<object classid="clsid
<param NAME="movie" value="correct.swf">
<param NAME="quality" value="High">
<param name="Src" value="correct.swf">
<param name="WMode" value="Window">
<param name="allowScriptAccess" value="always" />
<param name="Play" value="false">
<EMBED src="correct.swf" quality=high bgcolor=#FFFFFF WIDTH="246" HEIGHT="187" NAME="swfmovie" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</object>
</p>
<p>
<a href="javascript:document.swfmovie.Play()"><font face="Arial">►</font>play </a> <font face="Arial">
<a href="javascript:document.swfmovie.StopPlay()">║pause</a></font></p>
<p> </p>
</body>
</html>