Modify the code of Listing to include buttons to increase and decrease the video
ID: 3882304 • Letter: M
Question
Modify the code of Listing to include buttons to increase and decrease the video Zoom level. You will have to add you own .swf to make it work.
<head>
<title> Using Embedded Objects </title>
<script>
function flashLoaded(theMovie) {
if (typeof(theMovie) != "undefined") {
return theMovie.PercentLoaded() == 100;
} else {return false;}
}
function play(){
if flashLoaded(document.getDocumentByIdgetElementById('demo')) && !document.getElementById('demo').IsPlaying()){
document.getElementById('demo').Play();
}
}
function stop(){ if (flashLoaded( document.getDocumentByIdgetElementById('demo')) && document.getElementById('demo').IsPlaying()){
document.getElementById('demo').StopPlay();
}
}
function rewind(){
stop();
if (document.getElementById('demo').Rewind()) {
document.getElementById('demo').Rewind();
}
}
function zoomIn(){
if(document.getElementById('demo').Zoom()) {
document.getElementById('demo').Zoom();
}
}
function zoomOut(){
if(document.getElementById('demo').Zoom()) {
document.getElementById('demo').Zoom();
}
}
window.onload = function() {
document.getElementById("play").onclick = play;
document.getElementById("stop").onclick = stop;
document.getElementById("rewind").onclick = rewind;
document.getElementById("zoomIn").onclick = zoomIn;
document.getElementById("zoomOut").onclick = zoomOut;
}
</script>
</head>
<body>
<embed id="demo" name="demo"
src="example.swf"
width="318" height="300" play="false" loop="false"
pluginspage="http://www.macromedia.com/go/getflashplayer"
swliveconnect ="true">
</embed>
<form name="form" id="form">
<input id ="play" type ="button" value ="Start"/>
<input id ="stop" type ="button" value ="Stop"/>
<input id ="rewind" type ="button" value ="Rewind"/>
<input id ="Zoomin" type ="button" value ="Zoomin"/>
<input id ="Zoomout" type ="button" value ="Zoomout"/>
</ form >
</ body >
Explanation / Answer
<!DOCTYPE html>
<html>
<head>
<title> Using Embedded Objects </title>
<script>
function flashLoaded(theMovie) {
if (typeof(theMovie) != "undefined") {
return theMovie.PercentLoaded() == 100;
} else {return false;}
}
function play(){
if (flashLoaded(document.getElementById('demo')) && !document.getElementById('demo').IsPlaying())
{
document.getElementById('demo').Play();
}
}
function stop() {
if (flashLoaded(document.getElementById('demo')) && document.getElementById('demo').IsPlaying()) {
document.getElementById('demo').StopPlay();
}
}
function rewind(){
stop();
if (document.getElementById('demo').Rewind()) {
document.getElementById('demo').Rewind();
}
}
function zoomin(){
if(document.getElementById('demo').Zoom()) {
document.getElementById('demo').Zoom();
}
}
function zoomOut(){
if(document.getElementById('demo').Zoom()) {
document.getElementById('demo').Zoom();
}
}
window.onload = function() {
document.getElementById("play").onclick = play;
document.getElementById("stop").onclick = stop;
document.getElementById("rewind").onclick = rewind;
document.getElementById("zoomin").onclick = zoomin;
document.getElementById("zoomout").onclick = zoomout;
}
</script>
</head>
<body>
<embed id="demo" name="demo"
src="example.swf"
width="318" height="300" play="false" loop="false"
pluginspage="http://www.macromedia.com/go/getflashplayer"
swliveconnect="true"/>
<form name="form" id="form">
<input id="play" type="button" value="Start" />
<input id="stop" type="button" value="Stop" />
<input id="rewind" type="button" value="Rewind" />
<input id="zoomin" type="button" value="Zoomin" />
<input id="zoomout" type="button" value="Zoomout" />
</form>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.