A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How do i bind specific keys to functions??

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    59
    Just as it sounds.. i wanna bind say A,B,C,D to certain functions but all flash offers me is Shift,Enter, arrow keys etc...
    if anyone can help i would be most grateful

  2. #2
    Senior Member
    Join Date
    Apr 2000
    Location
    Northern Ireland
    Posts
    2,146
    You need to use the keycodes ... A to Z = 65 to 90 (A=65, B=66, C=67, etc.), and 0 to 9 = 48 to 57 (0=48, 1=49, 2=50, etc.). Then just use the onClipEvent(keyDown) handler:
    Code:
    onClipEvent(keyDown){
     if(Key.getCode == 65){
      // do some actions
     }
    }
    That will execute actions if the "A" key is pressed.

  3. #3
    Owner of the ™ thread tublu's Avatar
    Join Date
    Nov 2000
    Posts
    2,430
    you will find all the KEY CODES in the Help File Action Script Reference part . also for the extra keys like shift , capslock etc .

  4. #4
    Member
    Join Date
    Aug 2001
    Posts
    59
    Thanks heaps!

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