dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Assign F11 key to button?

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    20

    Assign F11 key to button?

    Hi,

    Is it possible to assign the F11 key to a button in flash as3? Haven't been able to find anything on the www.

    Thanks in advance.
    ss777

  2. #2
    Senior Member
    Join Date
    May 2004
    Posts
    226
    Assuming you have a button named "button":
    PHP Code:
    stage.addEventListenerKeyboardEvent.KEY_DOWNonKeyboardDown );
    button.addEventListenerMouseEvent.CLICKonButtonClick );
    function 
    onKeyboardDowne:KeyboardEvent ):void {
        if( 
    e.keyCode == Keyboard.F11 button.dispatchEvent( new MouseEventMouseEvent.CLICK ) );
    }
    function 
    onButtonClicke:MouseEvent ):void {
        
    trace"sup?" );

    Also, you have to to "Disable Keyboard Shortcuts" because F11 is used by flash.

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    20
    Many thanks for you quick response v5000. I was trying to assign the f11 key to a button in order to activate a browsers fullscreen mode, but unfortunately it doesn't work in safari or on macs, so I'm scrapping it. Again, many thanks.

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