views:

21

answers:

0

Hello i'm trying to play just the first few seconds on a quicktime movie then stop. if the user scrolls, I replay - Im doing this to reshow the image that seems to go away when scrolling. By design, once the user clicks 'Play' I want the movie to disregard the scroll (and other) functions. This seems to work in FF, but not in IE, where the movie will not even play initially. I'm getting a 'document.movie1 undefined error'. Any help is much appreciated. Here is the code....

<script src="include/javascript/AC_QuickTime.js" language="javascript"
type="text/javascript">

</script>
<script type="text/javascript" src="include/javascript/mootools-1.2.5-
core-nc.js"></script>
<script type="text/javascript" src="include/javascript/Quickie.js"></
script>
<!--if IE>
<object id="qt_event_source" classid="clsid:CB927D12-4FF7-4a9e-
A169-56E4B8A75598" codebase="http://www.apple.com/qtactivex/
qtplugin.cab#version=7,2,1,0" height="376" width="400">
<param name="scale" value="tofit" />
</object>
<!endif-->
<script type="text/javascript">


function BeginPlayback() {

if (document.movie1 !== null) {
document.movie1.Play();
document.movie1.SetTime(600);
var t = setTimeout("RewindPlayback()", 1000);
}

}

function RewindPlayback() {

if (document.movie1 !== null) {
document.movie1.Stop();
}
}
function QTSetup() {

var t = setTimeout("BeginPlayback()",1000);
}

function startUp() {
var myQuickie = new Quickie('http://malsup.github.com/video/
simpsons.mov', {
id: 'movie1',
width: 400,
height: 376,
container: 'qtmovie',
attributes: {
controller: 'true',
autoplay: 'true',
scale: 'tofit'
},
onCanplay: function() { },
onLoad: function() { QTSetup(); },
onPlay: function() {

if (document.getElementById("hfPlayed").value == "No" &&
document.getElementById("hfFromScroll").value == "No") {
document.getElementById("hfPlayed").value = "Yes";
}
},
onPause: function() { document.getElementById("hfFromScroll").value =
"No"; }
});
}

window.onscroll = function() {
if (document.getElementById("hfPlayed").value == "No") {
document.getElementById("hfFromScroll").value = "Yes";
BeginPlayback();
}
};
window.onresize = function() {
if (document.getElementById("hfPlayed").value == "No") {
document.getElementById("hfFromScroll").value = "Yes";
BeginPlayback();
}
};

function onBlur() {
if (document.getElementById("hfPlayed").value == "No") {
document.getElementById("hfFromScroll").value = "Yes";
BeginPlayback();
}
}
function onFocus() {
if (document.getElementById("hfPlayed").value == "No") {
document.getElementById("hfFromScroll").value = "Yes";
BeginPlayback();
}
}

if (/*@cc_on!@*/false) { // check for Internet Explorer
document.onfocusin = onFocus;
document.onfocusout = onBlur;
} else {
window.onfocus = onFocus;
window.onblur = onBlur;
}

</script>
<form id="form1" runat="server">



<input id="hfPlayed" type="hidden" value="No" />
<input id="hfFromScroll" type="hidden" value="Yes" />

</form>