Switch Focus to Captivate in Beginning
I want to disable the arrow keys so that the page does not scroll when the Captivate movie plays.
One of my simulations requires the use of UP and DOWN arrow keys. When they are pressed, the entire browser window scrolls. I don't want this.
I found this code on the Internet and added it to the Web page that has the embedded swf file.
<script type="text/javascript">
var keys = [];
window.addEventListener("keydown",
function(e){
keys[e.keyCode] = true;
switch(e.keyCode){
case 37: case 39: case 38: case 40: // Arrow keys
case 32: e.preventDefault(); break; // Space
default: break; // do not block other keys
}
},
false);
window.addEventListener('keyup',
function(e){
keys[e.keyCode] = false;
},
false);
</script>
It works in Firefox when Captivate movie loads. However, in IE, I have to press the TAB key in order to prevent the arrow keys from scrolling the entire page. I don't want my students to have to press the TAB key.
I was wondering if there is a way to shift the focus to the Captivate movie when the movie loads?
Thanks