mmasci
09-03-2004, 02:48 AM
The debate continues.... After reading the myriad of forum entries, I thought it was time to post one of my own.
Is there a way to disable function keys F5 and F1 in a swf? I have to use a swf and not a projector because of other fscommand calls that my flash needs to runs.
Below is the code i have "borrowed" from previous forum entries... as you can conclude, it doesn't work. Is there any headway that has been made into this area as a result of the AS2.0 release???
HTML/JavaScript code
document.onkeydown = function(){
if(window.event && window.event.keyCode == 116)
{ // Capture and remap F5
window.event.keyCode = 506;
}
if(window.event && window.event.keyCode == 506)
{ // New action for F5
alert('F5 key was pressed');
return false;
}
}
ActionScript code:
keyListener = new Object();
keyListener.onKeyDown = function() {
//getURL("javascript:alert('"+Key.getCode()+"')");
//trace (Key.getCode());
if (Key.getCode()>111 && Key.getCode()<=123) {
//trace (Key.getCode());
return false;
}
};
keyListener.onKeyUp = function() {
//getURL("javascript:alert('"+Key.getCode()+"')");
if (Key.getCode()>111 && Key.getCode()<=123) {
//trace (Key.getCode());
return false;
}
};
Key.addListener(keyListener);
Any thoughts/ideas????
M.
Is there a way to disable function keys F5 and F1 in a swf? I have to use a swf and not a projector because of other fscommand calls that my flash needs to runs.
Below is the code i have "borrowed" from previous forum entries... as you can conclude, it doesn't work. Is there any headway that has been made into this area as a result of the AS2.0 release???
HTML/JavaScript code
document.onkeydown = function(){
if(window.event && window.event.keyCode == 116)
{ // Capture and remap F5
window.event.keyCode = 506;
}
if(window.event && window.event.keyCode == 506)
{ // New action for F5
alert('F5 key was pressed');
return false;
}
}
ActionScript code:
keyListener = new Object();
keyListener.onKeyDown = function() {
//getURL("javascript:alert('"+Key.getCode()+"')");
//trace (Key.getCode());
if (Key.getCode()>111 && Key.getCode()<=123) {
//trace (Key.getCode());
return false;
}
};
keyListener.onKeyUp = function() {
//getURL("javascript:alert('"+Key.getCode()+"')");
if (Key.getCode()>111 && Key.getCode()<=123) {
//trace (Key.getCode());
return false;
}
};
Key.addListener(keyListener);
Any thoughts/ideas????
M.