A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to trap all keys

  1. #1
    Senior Member
    Join Date
    Apr 2002
    Posts
    113

    How to trap all keys

    I have a quiz projector file in full screen. I want to prevent students from using keyboard shortcuts like alt+tab or the win key. I tried...

    PHP Code:
    fscommand("trapallkeys""true"); 
    but it doesn't lock enough keys. I tried...

    PHP Code:
    stage.addEventListener(KeyboardEvent.KEY_DOWNmyKeyDownWIN);
    function 
    myKeyDownWIN(e:KeyboardEvent):void {
        if (
    e.keyCode==Keyboard.TAB) {
            
    fscommand("quit","true");
        }

    but it doesn't prevent alt+tab. I'd appreciate any help.

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    You're going to need some outside help, most likely from a third party swf2exe tool that can trap keys that Flash can't. I make one of those tools (SWF Studio) and in SWF Studio there's a checkbox on the Defaults Tab to start the application in kiosk mode.

    Kiosk mode disables the special Windows keys, Alt+F4, Ctrl+F4, Ctrl+Esc, Alt+Tab, Alt+Esc, PrtScr, Alt+PrtScr and Ctrl+Alt+Del. You would enable kiosk mode when you have to run your applications in unattended environments and don't want to allow users to access Windows.

    The Ctrl+Alt+Del key sequence cannot be reliably disabled under Windows NT, 2000 or XP unless you are running from an account with administrator privileges. If you need to secure an application for kiosk mode on a systems where the login account does not have admin privileges, you will have to modify the registry. See the article Securing Windows for use as Dedicated Kiosks for detailed instructions on how to accomplish this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center