A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [Quick] Key Codes to Key Names

  1. #1
    Senior Member UnknownGuy's Avatar
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    1,367

    [Quick] Key Codes to Key Names

    I know I've seen them around but I've done half a dozen searches and still can't find the convertors from Key codes to the names of the key(like a instead 65(or whatever it is), just so the user can make their own controls(for display purposes to them).

    I just can't find the link, seen a few of them, the huge arrays with all the codes already typed out is all I really need(if no one answers in a bit, I probably just write them out myself, so either way).

    Just trying to save myself a bit of time!

    Edit: I think Ihoss or Leight had one, though not certain...

  2. #2

  3. #3
    Untitled-2.fla
    Join Date
    Jul 2002
    Posts
    391
    attached
    Attached Files Attached Files

  4. #4
    Senior Member UnknownGuy's Avatar
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    1,367
    Thank you token 3, that's just what I needed and wanted.

    mbenney, just for clarification, I needed a convertor at runtime, not while authoring. Thanks for the help both of you!

  5. #5

  6. #6
    doItLikeThis
    Join Date
    Jan 2004
    Location
    :noitacoL
    Posts
    1,080
    -Aditya

  7. #7
    n00b LeechmasterB's Avatar
    Join Date
    May 2004
    Location
    Switzerland
    Posts
    1,067
    Hmm may be you can use this:
    http://www.flashdev.ch.vu/tutorials/input/Input.zip

    It contains arrays and functions which let you bind keys either by the keycode or by the key name (its not tested for all keys). But basically if you use the functions the right way you can let users bind keys by the "letter" or a predefined name (which you could edit in the source arrays if necessary).

    Its a zip with source for flash mx and 2k4 but I could not really test it on flash mx without the program, may be it helps. There might be better ways to do this to but still it was quiet handy for my purposes so far.

    EDIT:
    Oh yeah like if you use this you can have all game events mapped to global vars for example
    if(_global.move_left){
    // Move Left
    }
    And you can always change the key assosiated with that action meaning the code is independent from the mapped keys and a user can change them like you wanted...
    Mapping the keys with the maptokey function (or similar called).
    So all you need is pass the key the user chose to that function and say which action to assign to it and vice versa. So you have like a dynamic textbox for the keyname/keycode and actions to chose from for example or whatever...

    greets
    Last edited by LeechmasterB; 06-10-2005 at 04:37 AM. Reason: add sth
    I do stuff that does stuff...

    J-Force

  8. #8

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