OxygenThief
05-18-2012, 03:58 AM
Hello.
My difficulty is in adding Flash control buttons (play, stop, rewind, et cetera) to a window for playing movies.
My initial code to create a window for the Shockwave/Flash player worked just fine:
<html>
<head>
<title>Movie Player Example</title>
<script type="text/javascript"><!--
function playMovie(file){
var moviePlayer=window.open('assets/'&&file&&'', '', 'height=480,width=640,resizable=0,status=0,locationbar=0,menubar=0,top=200,left=350');
moviePlayer.document.write('<html><head><title>Movie Player</title>');
moviePlayer.document.write('<link rel="stylesheet" href="style.css">');
moviePlayer.document.write('</head><body"><center>');
moviePlayer.document.write('<object width="640" height="480">');
moviePlayer.document.write('<param name="movie" value="assets/'+file+'"></param>');
moviePlayer.document.write('<param name="wmode" value="transparent"></param>');
moviePlayer.document.write('<embed src="assets/'+file+'" type="application/x-shockwave-flash" wmode="transparent" width="640" height="480">');
moviePlayer.document.write('</embed></object>');
moviePlayer.document.write('</center></body></html>');
moviePlayer.document.close();
}
//--></script>
</head>
<body>
<p><a href="javascript:playMovie('mymovie.swf');">Create movie player window.</a></p>
</body>
</html>
However, I then tried to add some of the material found on this webpage: http://www.permadi.com/tutorial/flashjscommand/
The resulting code:
<html>
<head>
<title>Movie Player Example</title>
<script type="text/javascript"><!--
function playMovie(file){
var moviePlayer=window.open('assets/'&&file&&'', '', 'height=510,width=640,resizable=1,status=0,locationbar=0,menubar=0,top=200,left=350');
moviePlayer.document.write('<html><head><title>Movie Player</title>');
moviePlayer.document.write('<link rel="stylesheet" href="style.css">');
moviePlayer.document.write('<script type="text/javascript">');
moviePlayer.document.write('function getFlashMovieObject("assets/'&&file&&'"){var file=;if(window.document[file]){return window.document[file];}');
moviePlayer.document.write('if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds && document.embeds[file])return document.embeds[file];}');
moviePlayer.document.write('else{return document.getElementById(file);}}');
moviePlayer.document.write('function movieControlPlay(){var flashMovie=getFlashMovieObject("assets/'+file+'"); flashMovie.Play();}');
moviePlayer.document.write('function movieControlStop(){var flashMovie=getFlashMovieObject("'&&file&&'"); flashMovie.StopPlay();}');
moviePlayer.document.write('function movieControlRewind(){var flashMovie=getFlashMovieObject("assets/'&&file&&'"); flashMovie.Rewind();}');
moviePlayer.document.write('</script>');
moviePlayer.document.write('</head><body><center>');
moviePlayer.document.write('<object width="640" height="480">');
moviePlayer.document.write('<param name="movie" value="assets/'+file+'"></param>');
moviePlayer.document.write('<param name="ShowControls" value="1">');
moviePlayer.document.write('<param name="wmode" value="transparent"></param>');
moviePlayer.document.write('<embed src="assets/'+file+'" type="application/x-shockwave-flash" wmode="transparent" width="640" height="480" pluginspage="http://www.macromedia.com/go/getflashplayer">');
moviePlayer.document.write('</embed></object>');
moviePlayer.document.write('<a href="javascript:movieControlPlay();"><img src="play.png" alt="Play" height="50" width="50" border="0" /></a> ');
moviePlayer.document.write('<a href="javascript:movieControlStop();"><img src="stop.png" alt="Stop" height="50" width="50" border="0" /></a> ');
moviePlayer.document.write('<a href="javascript:movieControlRewind();"><img src="rewind.png" alt="Rewind" height="50" width="50" border="0" /></a>');
moviePlayer.document.write('</center></body></html>');
moviePlayer.document.close();
}
//--></script>
</head>
<body>
<p><a href="javascript:playMovie('mymovie.swf');">Create movie player window.</a></p>
</body>
</html>
Where the problem is:
moviePlayer.document.write('<script type="text/javascript">');
moviePlayer.document.write('function getFlashMovieObject("assets/'&&file&&'"){var file=;if(window.document[file]){return window.document[file];}');
moviePlayer.document.write('if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds && document.embeds[file])return document.embeds[file];}');
moviePlayer.document.write('else{return document.getElementById(file);}}');
moviePlayer.document.write('function movieControlPlay(){var flashMovie=getFlashMovieObject("assets/'+file+'"); flashMovie.Play();}');
moviePlayer.document.write('function movieControlStop(){var flashMovie=getFlashMovieObject("'&&file&&'"); flashMovie.StopPlay();}');
moviePlayer.document.write('function movieControlRewind(){var flashMovie=getFlashMovieObject("assets/'&&file&&'"); flashMovie.Rewind();}');
moviePlayer.document.write('</script>');
And:
<p><a href="javascript:playMovie('mymovie.swf');">Create movie player window.</a></p>
So it's just the sections dealing with the buttons and handling the buttons in the generated page header. Any help would be appreciated. Thanks.
My difficulty is in adding Flash control buttons (play, stop, rewind, et cetera) to a window for playing movies.
My initial code to create a window for the Shockwave/Flash player worked just fine:
<html>
<head>
<title>Movie Player Example</title>
<script type="text/javascript"><!--
function playMovie(file){
var moviePlayer=window.open('assets/'&&file&&'', '', 'height=480,width=640,resizable=0,status=0,locationbar=0,menubar=0,top=200,left=350');
moviePlayer.document.write('<html><head><title>Movie Player</title>');
moviePlayer.document.write('<link rel="stylesheet" href="style.css">');
moviePlayer.document.write('</head><body"><center>');
moviePlayer.document.write('<object width="640" height="480">');
moviePlayer.document.write('<param name="movie" value="assets/'+file+'"></param>');
moviePlayer.document.write('<param name="wmode" value="transparent"></param>');
moviePlayer.document.write('<embed src="assets/'+file+'" type="application/x-shockwave-flash" wmode="transparent" width="640" height="480">');
moviePlayer.document.write('</embed></object>');
moviePlayer.document.write('</center></body></html>');
moviePlayer.document.close();
}
//--></script>
</head>
<body>
<p><a href="javascript:playMovie('mymovie.swf');">Create movie player window.</a></p>
</body>
</html>
However, I then tried to add some of the material found on this webpage: http://www.permadi.com/tutorial/flashjscommand/
The resulting code:
<html>
<head>
<title>Movie Player Example</title>
<script type="text/javascript"><!--
function playMovie(file){
var moviePlayer=window.open('assets/'&&file&&'', '', 'height=510,width=640,resizable=1,status=0,locationbar=0,menubar=0,top=200,left=350');
moviePlayer.document.write('<html><head><title>Movie Player</title>');
moviePlayer.document.write('<link rel="stylesheet" href="style.css">');
moviePlayer.document.write('<script type="text/javascript">');
moviePlayer.document.write('function getFlashMovieObject("assets/'&&file&&'"){var file=;if(window.document[file]){return window.document[file];}');
moviePlayer.document.write('if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds && document.embeds[file])return document.embeds[file];}');
moviePlayer.document.write('else{return document.getElementById(file);}}');
moviePlayer.document.write('function movieControlPlay(){var flashMovie=getFlashMovieObject("assets/'+file+'"); flashMovie.Play();}');
moviePlayer.document.write('function movieControlStop(){var flashMovie=getFlashMovieObject("'&&file&&'"); flashMovie.StopPlay();}');
moviePlayer.document.write('function movieControlRewind(){var flashMovie=getFlashMovieObject("assets/'&&file&&'"); flashMovie.Rewind();}');
moviePlayer.document.write('</script>');
moviePlayer.document.write('</head><body><center>');
moviePlayer.document.write('<object width="640" height="480">');
moviePlayer.document.write('<param name="movie" value="assets/'+file+'"></param>');
moviePlayer.document.write('<param name="ShowControls" value="1">');
moviePlayer.document.write('<param name="wmode" value="transparent"></param>');
moviePlayer.document.write('<embed src="assets/'+file+'" type="application/x-shockwave-flash" wmode="transparent" width="640" height="480" pluginspage="http://www.macromedia.com/go/getflashplayer">');
moviePlayer.document.write('</embed></object>');
moviePlayer.document.write('<a href="javascript:movieControlPlay();"><img src="play.png" alt="Play" height="50" width="50" border="0" /></a> ');
moviePlayer.document.write('<a href="javascript:movieControlStop();"><img src="stop.png" alt="Stop" height="50" width="50" border="0" /></a> ');
moviePlayer.document.write('<a href="javascript:movieControlRewind();"><img src="rewind.png" alt="Rewind" height="50" width="50" border="0" /></a>');
moviePlayer.document.write('</center></body></html>');
moviePlayer.document.close();
}
//--></script>
</head>
<body>
<p><a href="javascript:playMovie('mymovie.swf');">Create movie player window.</a></p>
</body>
</html>
Where the problem is:
moviePlayer.document.write('<script type="text/javascript">');
moviePlayer.document.write('function getFlashMovieObject("assets/'&&file&&'"){var file=;if(window.document[file]){return window.document[file];}');
moviePlayer.document.write('if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds && document.embeds[file])return document.embeds[file];}');
moviePlayer.document.write('else{return document.getElementById(file);}}');
moviePlayer.document.write('function movieControlPlay(){var flashMovie=getFlashMovieObject("assets/'+file+'"); flashMovie.Play();}');
moviePlayer.document.write('function movieControlStop(){var flashMovie=getFlashMovieObject("'&&file&&'"); flashMovie.StopPlay();}');
moviePlayer.document.write('function movieControlRewind(){var flashMovie=getFlashMovieObject("assets/'&&file&&'"); flashMovie.Rewind();}');
moviePlayer.document.write('</script>');
And:
<p><a href="javascript:playMovie('mymovie.swf');">Create movie player window.</a></p>
So it's just the sections dealing with the buttons and handling the buttons in the generated page header. Any help would be appreciated. Thanks.