Yes, but if you don't use keyEvent.ctrlKey in your event handler, but check for CTRL and set a flag:

e.g.

public static const CTRL_KEYCODE:int = 17;
private var _ctrlKeyDown:Boolean = false;
//etc

function onKeyDownHandler(e:KeyboardEvent):void
{
        switch(e.keyCode) {

                case CTRL_KEYCODE:
                        _ctrlKeyDown = true;
                        return;
                        break; //your choice if you put break after return
                //case ALT_KEYCODE:
                //      _altKeyDown = true;     
                //      return;
                //      break;
                default:
                        break;
        }
        
        trace("onKeyDown: ctrlKeyDown=" + _ctrlKeyDown);                        
      
}

function onKeyUpHandler(e:KeyboardEvent):void
{
        switch(e.keyCode) {

                case CTRL_KEYCODE:
                        _ctrlKeyDown = false;
                        return;
                        break; //your choice if you put break after return
                //case ALT_KEYCODE:
                //      _altKeyDown = false;    
                /       return;
                //      break;
                default:
                        break;
        }

        trace("onKeyUp: e.ctrlKey=" + e.ctrlKey + ", e.altKey=" + e.altKey);

}




On 15/11/2010 23:34, Benny wrote:
Thanks for the tip Glen.

Unfortunately that class also shows the problem of Keyboard.CONTROL (keycode
17) being reported as being down (while it actual isn't) when the right alt
key is being pressed.

- Benny


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to