A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Converting Key.getAscii value to character

  1. #1
    Ubi bene, ibi patria Nightcap's Avatar
    Join Date
    Jun 2007
    Location
    GA, USA
    Posts
    184

    Converting Key.getAscii value to character

    My code is reading keystrokes using Key.addListener. That works great, but the only way I can convert the Key.getAscii value to a character is by doing it like this:

    Code:
    String.fromCharCode(Key.getAscii())
    Is that correct or is there a better way? Am I right that KM doesn't support the 'chr' and 'ord' functions?
    Everybody thinks of changing humanity,
    Nobody thinks of changing himself.

  2. #2
    Ubi bene, ibi patria Nightcap's Avatar
    Join Date
    Jun 2007
    Location
    GA, USA
    Posts
    184
    Bump...

    Nobody?!?
    Everybody thinks of changing humanity,
    Nobody thinks of changing himself.

  3. #3
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    You did it the right way.
    Both 'chr' and 'ord' were deprecated years ago.

  4. #4
    Ubi bene, ibi patria Nightcap's Avatar
    Join Date
    Jun 2007
    Location
    GA, USA
    Posts
    184
    Thanks Wilbert, that was all I needed to know.

    It can be quite confusing looking at older AS examples and then finding out that the code won't work because of something like 'chr and 'ord'. But we'll get there.
    Everybody thinks of changing humanity,
    Nobody thinks of changing himself.

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