Capture the escape key
I have a flash site where users can view full screen video. the problem is I am only making a full screen video player (hiding the rest of the site behind it).
my "toggle full screen" button works so that it shrinks the video player to its normal size when the user switches back from full screen.
but when the user presses the evacuation key, my flash script doesn't know the video player should be downsized.
there seems to be no way to capture the ESCAPE key as a key event. any ideas?
+2
a source to share
2 answers
Register for this event:
this.stage.addEventListener( flash.events.FullScreenEvent.FULL_SCREEN , this.noticeDisplayState );
Then process it:
public function noticeDisplayState( inEvent:Event ) {
if ( this.stage.displayState != StageDisplayState.FULL_SCREEN ) {
// escape key pressed
}
}
+2
a source to share