PDA

View Full Version : capture print screen!


colfaxrev
03-06-2006, 05:47 PM
Is there a way to capture the event of when someone presses the print screen button on the keyboard?

I've tried this and it doesn't get print screen


keylis = new Object;
keylis.onKeyDown = function()
{
trace("Code: "+Key.getCode());
trace("Ascii: "+Key.getAscii());
}
Key.addListener(keylis);


surprisingly this DID capture the Windows button, INSERT, SCROLL lock, pause break, Num Lock, Ctrl, Shift, and the Arrow Keys

but the following keys did not send an event to flash:

backspace
tab
enter
< ,
> .
Alt
Delete
Home
End
Page Up
Page Down
Enter on Number Key Pad
ESC
Print Screen

i dont think F1 through F12 do anything. But you probably wouldn't want to do anything with those anyway as most browsers use some of those keys.

anyway, again my question, is there a way to capture the Print Screen key? I know there are ways of capturing ENTER, but im not exactly sure how to do that even.

oddsox
03-06-2006, 07:03 PM
I did a quick search and found this a post under scrollPane screen capture issue that shows 44 as the answer. I made a quick hack-edit from the code in that post that you can try to confirm the printscreen key is captured. Not sure what OS/browsers it works but work on mine, PC/FF.


Key.addListener(keyListener);
//
onEnterFrame = function () {
if (Key.isDown(44)) {
trace("Hello world");
}
};


original post/thread (http://www.actionscript.org/forums/showthread.php3?t=96557) from Navarone

hth
oddsox