" /> Last ActionScript Hero - Blog - Flash & Related Technologies: February 2006 Archives

« December 2005 | Main | April 2006 »

February 09, 2006

Detecting Print Screen in Flash

Listen to this article Listen to this article :: Talkr

This should be probably the nth time somebody has asked me about this. Thought I will just blog this so someone else who is looking for the same solution would find this useful.

For capturing Print Screen, the traditional Key.addListener(myListener); method wouldn't work and the alternative which I use on my projects is this one and it works:

this.onEnterFrame = function (){
if (Key.isDown(44)) {
trace("Dont try to capture me!");
}
}

Usually this method is used to prevent the user from capturing the screen but definelty this is not a 100% fool prrof method and by the time Flash detects the key press and does something - Windows would have already captured the screen. But yes if you want to warn your user not to take a screen shot you can use this.

If someone out there know of a better solution just post a comment and let the world know of it.