Ok, I cannot figure out what to do to get this to work. So here it is:
Here is the functions I have related to this:
<script type="text/javascript" src="swfobject.js">
</script>
<script>
var started = false;
function sendEvent(typ,prm) {
thisMovie('mpl').sendEvent(typ,prm); };
function getUpdate(typ, pr1, pr2, pid) {
if(typ == 'state') {
if((pr1 == 2) && (started == false)) {
// remember that player is started
started = true; }
// keep checking to see if player is completed
if(pr1 == 3) {
// reset started because player is completed
started = false;
// make him disappear
document.getElementById('id').style.visibility = 'hidden'; }
}
};
function thisMovie(movieName) {
if(navigator.appName.indexOf('Microsoft') != -1) {
return window[movieName]; }
else {
return document[movieName]; }
};
Here is the embed and the button:
<embed src="http://www.mysite.com/TrainVid/mediaplayer.swf" width="400" bgcolor="0xccc3ad" height="300" allowfullscreen="true"allowscriptaccess="always"flashvars="&file=http://www.mysite.com/TrainVid/test.flv&height=300&displayheight=300&showicons=false&width=400&autostart=true&javascriptid=mpl&enablejs=true&type=flv" />
<BR><BR><center><input type=button value="button" onClick="javascript:sendEvent('playpause',0); return false;">
When I try it, I get this error (which seems to be pointing to this line: thisMovie('mpl').sendEvent(typ,prm); };)
'undefined' is null or not an object.
Anybody?
Thanks,
Doc
Try this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>tthdoc</title>
<script type="text/javascript">
var started = false;
function sendEvent(typ, prm)
{
thisMovie('mpl').sendEvent(typ, prm);
};
function getUpdate(typ, pr1, pr2, pid)
{
if(typ == 'state')
{
if((pr1 == 2) && (started == false))
{
// remember that player is started
started = true;
}
// keep checking to see if player is completed
if(pr1 == 3)
{
// reset started because player is completed
started = false;
// make him disappear
document.getElementById('mpl').style.visibility = 'hidden';
}
}
};
function thisMovie(movieName)
{
if(navigator.appName.indexOf('Microsoft') != -1)
{
return window[movieName];
}
else
{
return document[movieName];
}
};
</script>
</head>
<body>
<object id="mpl" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="300">
<param name="movie" value="http://www.mysite.com/TrainVid/mediaplayer.swf" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="width=400&height=300&displayheight=300&file=http://www.mysite.com/TrainVid/test.flv&showicons=false&autostart=true&javascriptid=mpl&enablejs=true" />
<embed src="http://www.mysite.com/TrainVid/mediaplayer.swf" name="mpl" width="400" height="300" bgcolor="0xccc3ad" allowfullscreen="true" allowscriptaccess="always" flashvars="width=400&height=300&displayheight=300&file=http://www.mysite.com/TrainVid/test.flv&showicons=false&autostart=true&javascriptid=mpl&enablejs=true" />
</object>
<br />
<br />
<center>
<button onClick="javascript:sendEvent('playpause'); return false;">Play/Pause</button>
<button onClick="javascript:document.getElementById('mpl').style.visibility = 'hidden'; return false;">Hidden</button>
<button onClick="javascript:document.getElementById('mpl').style.visibility = 'visible'; return false;">Visible</button>
</center>
</body>
</html>